nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Token.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
69 * @return same or adjusted token. |
69 * @return same or adjusted token. |
70 */ |
70 */ |
71 public static long withDelimiter(final long token) { |
71 public static long withDelimiter(final long token) { |
72 final TokenType tokenType = Token.descType(token); |
72 final TokenType tokenType = Token.descType(token); |
73 switch(tokenType) { |
73 switch(tokenType) { |
74 case STRING: case ESCSTRING: case EXECSTRING: { |
74 case STRING: |
|
75 case ESCSTRING: |
|
76 case EXECSTRING: |
|
77 case TEMPLATE: |
|
78 case TEMPLATE_TAIL: { |
75 final int start = Token.descPosition(token) - 1; |
79 final int start = Token.descPosition(token) - 1; |
76 final int len = Token.descLength(token) + 2; |
80 final int len = Token.descLength(token) + 2; |
|
81 return toDesc(tokenType, start, len); |
|
82 } |
|
83 case TEMPLATE_HEAD: |
|
84 case TEMPLATE_MIDDLE: { |
|
85 final int start = Token.descPosition(token) - 1; |
|
86 final int len = Token.descLength(token) + 3; |
77 return toDesc(tokenType, start, len); |
87 return toDesc(tokenType, start, len); |
78 } |
88 } |
79 default: { |
89 default: { |
80 return token; |
90 return token; |
81 } |
91 } |