1 package net.sourceforge.phpeclipse.phpeditor;
3 import java.util.HashMap;
5 import net.sourceforge.phpeclipse.phpeditor.php.PHPKeywords;
7 /**********************************************************************
8 Copyright (c) 2000, 2002 IBM Corp. and others.
9 All rights reserved. This program and the accompanying materials
10 are made available under the terms of the Common Public License v1.0
11 which accompanies this distribution, and is available at
12 http://www.eclipse.org/legal/cpl-v10.html
15 IBM Corporation - Initial implementation
16 Klaus Hartlage - www.eclipseproject.de
17 **********************************************************************/
19 public class PHPParser extends PHPKeywords {
21 private static HashMap keywordMap = null;
29 // row counter for syntax errors:
31 // column counter for syntax errors:
42 final static int TT_EOF = 0;
43 final static int TT_UNDEFINED = 1;
45 final static int TT_MOD = 30;
46 final static int TT_NOT = 31;
47 final static int TT_DOT = 32;
48 final static int TT_POW = 33;
49 final static int TT_DIV = 34;
50 final static int TT_MULTIPLY = 35;
51 final static int TT_SUBTRACT = 36;
52 final static int TT_ADD = 37;
53 final static int TT_EQUAL = 38;
54 final static int TT_UNEQUAL = 39;
55 final static int TT_GREATER = 40;
56 final static int TT_GREATEREQUAL = 41;
57 final static int TT_LESS = 42;
58 final static int TT_LESSEQUAL = 43;
59 final static int TT_AND = 44;
60 final static int TT_OR = 45;
61 final static int TT_HASH = 46;
62 final static int TT_DDOT = 47;
63 final static int TT_DOTASSIGN = 48;
65 final static int TT_SET = 49;
66 final static int TT_REF = 50;
67 final static int TT_FOREACH = 51;
68 final static int TT_AMPERSAND = 52;
69 final static int TT_DOLLARLISTOPEN = 53;
70 final static int TT_TILDE = 54;
72 final static int TT_ARGOPEN = 128;
73 final static int TT_ARGCLOSE = 129;
74 final static int TT_LISTOPEN = 130;
75 final static int TT_LISTCLOSE = 131;
76 final static int TT_PARTOPEN = 132;
77 final static int TT_PARTCLOSE = 133;
78 final static int TT_COMMA = 134;
80 final static int TT_STRING = 136;
81 final static int TT_IDENTIFIER = 138;
82 final static int TT_DIGIT = 139;
83 final static int TT_SEMICOLON = 140;
84 final static int TT_SLOT = 141;
85 final static int TT_SLOTSEQUENCE = 142;
86 final static int TT_DECREMENT = 144;
87 final static int TT_INCREMENT = 145;
88 final static int TT_ADDTO = 146;
89 final static int TT_DIVIDEBY = 147;
90 final static int TT_SUBTRACTFROM = 148;
91 final static int TT_TIMESBY = 149;
92 final static int TT_VARIABLE = 150;
93 final static int TT_INT_NUMBER = 151;
94 final static int TT_DOUBLE_NUMBER = 152;
95 final static int TT_INTERPOLATED_STRING = 153;
96 final static int TT_STRING_CONSTANT = 154;
98 final static int TT_LSHIFT = 155;
99 final static int TT_RSHIFT = 156;
100 final static int TT_EX_EQUAL = 157;
101 final static int TT_EX_UNEQUAL = 158;
102 final static int TT_LINE = 159;
103 // final static int TT_AT = 153; // @
108 *@param sess Description of Parameter
112 if (keywordMap == null) {
113 keywordMap = new HashMap();
114 for (int i = 0; i < PHP_KEYWORS.length; i++) {
115 keywordMap.put(PHP_KEYWORS[i], new Integer(PHP_KEYWORD_TOKEN[i]));
122 this.columnCount = 0;
127 private void throwSyntaxError(String error) {
129 if (str.length() < chIndx) {
132 // read until end-of-line
134 while (str.length() > eol) {
135 ch = str.charAt(eol++);
141 throw new SyntaxError(rowCount, chIndx - columnCount + 1, str.substring(columnCount, eol), error);
145 * Method Declaration.
150 if (str.length() > chIndx) {
151 ch = str.charAt(chIndx++);
156 chIndx = str.length() + 1;
162 * gets the next token from input
164 void getNextToken() {
165 while (str.length() > chIndx) {
166 ch = str.charAt(chIndx++);
167 token = TT_UNDEFINED;
170 columnCount = chIndx;
171 continue; // while loop
174 if (!Character.isWhitespace(ch)) {
175 if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '_') || (ch == '$') || (ch == '@')) {
179 if (ch >= '0' && ch <= '9') {
184 if (str.length() > chIndx) {
185 if (str.charAt(chIndx) == '/') {
187 // read comment until end of line:
188 while ((str.length() > chIndx) && (str.charAt(chIndx) != '\n')) {
192 } else if (str.charAt(chIndx) == '*') {
194 // multi line comment:
195 while (str.length() > chIndx) {
196 if (str.charAt(chIndx) == '*' && (str.length() > (chIndx + 1)) && str.charAt(chIndx + 1) == '/') {
205 } else if (ch == '#') {
206 // read comment until end of line:
207 while ((str.length() > chIndx) && (str.charAt(chIndx) != '\n')) {
211 } else if (ch == '"') {
212 // read string until end
213 boolean openString = true;
214 while (str.length() > chIndx) {
215 ch = str.charAt(chIndx++);
217 if (str.length() > chIndx) {
218 ch = str.charAt(chIndx++);
220 } else if (ch == '"') {
226 columnCount = chIndx;
231 throwSyntaxError("Open string character '\"' at end of file.");
233 token = TT_INTERPOLATED_STRING;
235 } else if (ch == '\'') {
236 // read string until end
237 boolean openString = true;
238 while (str.length() > chIndx) {
239 ch = str.charAt(chIndx++);
241 if (str.length() > chIndx) {
242 ch = str.charAt(chIndx++);
244 } else if (ch == '\'') {
250 columnCount = chIndx;
255 throwSyntaxError("Open string character \"'\" at end of file.");
257 token = TT_STRING_CONSTANT;
276 token = TT_LISTCLOSE;
284 token = TT_PARTCLOSE;
297 if (str.length() > chIndx) {
298 if (str.charAt(chIndx) == '=') {
300 token = TT_DOTASSIGN;
316 token = TT_SEMICOLON;
326 if (str.length() > chIndx) {
327 if (str.charAt(chIndx) == '=') {
338 if (str.length() > chIndx) {
339 if (str.charAt(chIndx) == '*') {
345 if (str.charAt(chIndx) == '=') {
356 if (str.length() > chIndx) {
357 if (str.charAt(chIndx) == '+') {
359 token = TT_INCREMENT;
363 if (str.charAt(chIndx) == '=') {
373 if (str.length() > chIndx) {
374 if (str.charAt(chIndx) == '-') {
376 token = TT_DECREMENT;
380 if (str.charAt(chIndx) == '=') {
382 token = TT_SUBTRACTFROM;
386 if (str.charAt(chIndx) == '>') {
398 if (str.length() > chIndx) {
399 ch = str.charAt(chIndx);
404 if (str.length() > chIndx) {
405 ch = str.charAt(chIndx);
426 if (str.length() > chIndx) {
427 if (str.charAt(chIndx) == '=') {
430 if (str.length() > chIndx) {
431 ch = str.charAt(chIndx);
435 token = TT_EX_UNEQUAL;
446 if (str.length() > chIndx) {
447 if (str.charAt(chIndx) == '=') {
449 token = TT_GREATEREQUAL;
453 if (str.charAt(chIndx) == '>') {
465 if (str.length() > chIndx) {
466 if (str.charAt(chIndx) == '=') {
468 token = TT_LESSEQUAL;
472 if (str.charAt(chIndx) == '<') {
485 if (str.length() > chIndx) {
486 if (str.charAt(chIndx) == '|') {
496 if (str.length() > chIndx) {
497 if (str.charAt(chIndx) == '&') {
503 token = TT_AMPERSAND;
523 throwSyntaxError("unexpected character: '" + ch + "'");
526 if (token == TT_UNDEFINED) {
527 throwSyntaxError("token not found");
534 chIndx = str.length() + 1;
539 void getIdentifier() {
540 StringBuffer ident = new StringBuffer();
546 token = TT_IDENTIFIER;
549 while ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '_')) {
553 identifier = ident.toString();
556 Integer i = (Integer) keywordMap.get(identifier.toLowerCase());
558 token = i.intValue();
563 StringBuffer inum = new StringBuffer();
572 // determine number conversions:
573 if (firstCh == '0') {
602 if (numFormat == 16) {
603 while ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')) {
608 while ((ch >= '0' && ch <= '9') || (ch == '.') || (ch == 'E') || (ch == 'e')) {
609 if ((ch == '.') || (ch == 'E') || (ch == 'e')) {
610 if (ch == '.' && dFlag != ' ') {
613 if ((dFlag == 'E') || (dFlag == 'e')) {
619 if ((ch == '-') || (ch == '+')) {
633 doubleNumber = new Double(inum.toString());
634 token = TT_DOUBLE_NUMBER;
637 longNumber = Long.valueOf(inum.toString(), numFormat);
638 token = TT_INT_NUMBER;
642 } catch (Throwable e) {
643 throwSyntaxError("Number format error: " + inum.toString());
647 public void start(String s, int rowCount) throws SyntaxError {
652 this.rowCount = rowCount;
653 this.columnCount = 0;
657 if (token != TT_EOF) {
658 if (token == TT_ARGCLOSE) {
659 throwSyntaxError("too many closing ')'; end-of-file not reached");
661 if (token == TT_LISTCLOSE) {
662 throwSyntaxError("too many closing '}'; end-of-file not reached");
664 if (token == TT_PARTCLOSE) {
665 throwSyntaxError("too many closing ']'; end-of-file not reached");
668 if (token == TT_ARGOPEN) {
669 throwSyntaxError("read character '('; end-of-file not reached");
671 if (token == TT_LISTOPEN) {
672 throwSyntaxError("read character '{'; end-of-file not reached");
674 if (token == TT_PARTOPEN) {
675 throwSyntaxError("read character '['; end-of-file not reached");
678 throwSyntaxError("end-of-file not reached");
683 public void statementList() {
686 if ((token == TT_LISTCLOSE)
687 || (token == TT_case)
688 || (token == TT_default)
689 || (token == TT_elseif)
690 || (token == TT_endif)
691 || (token == TT_endfor)
692 || (token == TT_endforeach)
693 || (token == TT_endwhile)
694 || (token == TT_endswitch)
695 || (token == TT_EOF)) {
701 public void compoundStatement() {
702 // '{' [statement-list] '}'
703 if (token == TT_LISTOPEN) {
706 throwSyntaxError("'{' expected in compound-statement.");
708 if (token != TT_LISTCLOSE) {
711 if (token == TT_LISTCLOSE) {
714 throwSyntaxError("'}' expected in compound-statement.");
718 public void statement() {
719 if (token > TT_KEYWORD && token != TT_list) {
720 String keyword = identifier;
721 if (token == TT_include || token == TT_include_once) {
724 if (token == TT_SEMICOLON) {
727 throwSyntaxError("';' character after 'include' or 'include_once' expected.");
730 } else if (token == TT_require || token == TT_require_once) {
734 if (token == TT_SEMICOLON) {
737 throwSyntaxError("';' character after 'require' or 'require_once' expected.");
740 } else if (token == TT_if) {
742 if (token == TT_ARGOPEN) {
745 throwSyntaxError("'(' expected after 'if' keyword.");
748 if (token == TT_ARGCLOSE) {
751 throwSyntaxError("')' expected after 'if' condition.");
756 } else if (token == TT_switch) {
758 if (token == TT_ARGOPEN) {
761 throwSyntaxError("'(' expected after 'switch' keyword.");
764 if (token == TT_ARGCLOSE) {
767 throwSyntaxError("')' expected after 'switch' condition.");
771 } else if (token == TT_for) {
773 if (token == TT_ARGOPEN) {
776 throwSyntaxError("'(' expected after 'for' keyword.");
778 if (token == TT_SEMICOLON) {
782 if (token == TT_SEMICOLON) {
785 throwSyntaxError("';' character after 'for' expected.");
788 if (token == TT_SEMICOLON) {
792 if (token == TT_SEMICOLON) {
795 throwSyntaxError("';' character after 'for' expected.");
798 if (token == TT_ARGCLOSE) {
802 if (token == TT_ARGCLOSE) {
805 throwSyntaxError("')' expected after 'for' condition.");
810 } else if (token == TT_while) {
812 if (token == TT_ARGOPEN) {
815 throwSyntaxError("'(' expected after 'while' keyword.");
818 if (token == TT_ARGCLOSE) {
821 throwSyntaxError("')' expected after 'while' condition.");
825 } else if (token == TT_foreach) {
827 if (token == TT_ARGOPEN) {
830 throwSyntaxError("'(' expected after 'foreach' keyword.");
833 if (token == TT_as) {
836 throwSyntaxError("'as' expected after 'foreach' exxpression.");
839 if (token == TT_FOREACH) {
843 if (token == TT_ARGCLOSE) {
846 throwSyntaxError("')' expected after 'foreach' expression.");
851 } else if (token == TT_continue || token == TT_break || token == TT_return) {
853 if (token != TT_SEMICOLON) {
856 if (token == TT_SEMICOLON) {
859 throwSyntaxError("';' expected after 'continue', 'break' or 'return'.");
863 } else if (token == TT_echo) {
866 if (token == TT_SEMICOLON) {
869 throwSyntaxError("';' expected after 'echo' statement.");
873 } else if (token == TT_print) {
876 if (token == TT_SEMICOLON) {
879 throwSyntaxError("';' expected after 'print' statement.");
883 } else if (token == TT_global || token == TT_static) {
886 if (token == TT_SEMICOLON) {
889 throwSyntaxError("';' expected after 'global' or 'static' statement.");
893 } else if (token == TT_unset) {
895 if (token == TT_ARGOPEN) {
898 throwSyntaxError("'(' expected after 'unset' keyword.");
901 if (token == TT_ARGCLOSE) {
904 throwSyntaxError("')' expected after 'unset' statement.");
906 if (token == TT_SEMICOLON) {
909 throwSyntaxError("';' expected after 'unset' statement.");
913 } else if (token == TT_exit || token == TT_die) {
915 if (token != TT_SEMICOLON) {
918 if (token == TT_SEMICOLON) {
921 throwSyntaxError("';' expected after 'exit' or 'die' statement.");
925 } else if (token == TT_define) {
927 if (token == TT_ARGOPEN) {
930 throwSyntaxError("'(' expected after 'define' keyword.");
933 if (token == TT_COMMA) {
936 throwSyntaxError("',' expected after first 'define' constant.");
939 if (token == TT_ARGCLOSE) {
942 throwSyntaxError("')' expected after 'define' statement.");
944 if (token == TT_SEMICOLON) {
947 throwSyntaxError("';' expected after 'define' statement.");
950 } else if (token == TT_function) {
952 functionDefinition();
955 throwSyntaxError("Unexpected keyword '" + keyword + "'");
958 } else if (token == TT_LISTOPEN) {
961 if (token != TT_LISTCLOSE) {
964 if (token == TT_LISTCLOSE) {
968 throwSyntaxError("'}' expected.");
971 if (token != TT_SEMICOLON) {
974 if (token == TT_SEMICOLON) {
978 throwSyntaxError("';' expected after expression.");
984 public void functionDefinition() {
985 functionDeclarator();
989 public void functionDeclarator() {
990 //identifier '(' [parameter-list] ')'
991 if (token == TT_IDENTIFIER) {
993 if (token == TT_ARGOPEN) {
996 throwSyntaxError("'(' expected in function declaration.");
998 if (token != TT_ARGCLOSE) {
1001 if (token != TT_ARGCLOSE) {
1002 throwSyntaxError("')' expected in function declaration.");
1009 public void parameterList() {
1010 //parameter-declaration
1011 //parameter-list ',' parameter-declaration
1013 parameterDeclaration();
1014 if (token != TT_COMMA) {
1021 public void parameterDeclaration() {
1023 //variable-reference
1024 //variable '=' constant
1025 if (token == TT_VARIABLE) {
1027 if (token == TT_SET) {
1035 public void labeledStatementList() {
1036 if (token != TT_case && token != TT_default) {
1037 throwSyntaxError("'case' or 'default' expected.");
1040 if (token == TT_case) {
1043 if (token == TT_DDOT) {
1047 throwSyntaxError("':' character after 'case' constant expected.");
1049 } else { // TT_default
1051 if (token == TT_DDOT) {
1055 throwSyntaxError("':' character after 'default' expected.");
1058 } while (token == TT_case || token == TT_default);
1061 // public void labeledStatement() {
1062 // if (token == TT_case) {
1065 // if (token == TT_DDOT) {
1069 // throwSyntaxError("':' character after 'case' constant expected.");
1072 // } else if (token == TT_default) {
1074 // if (token == TT_DDOT) {
1078 // throwSyntaxError("':' character after 'default' expected.");
1084 public void expressionStatement() {
1087 public void inclusionStatement() {
1090 // public void compoundStatement() {
1093 // public void selectionStatement() {
1096 // public void iterationStatement() {
1099 // public void jumpStatement() {
1102 // public void outputStatement() {
1105 // public void scopeStatement() {
1108 // public void flowStatement() {
1111 // public void definitionStatement() {
1114 public void ifStatement() {
1115 // ':' statement-list [elseif-list] [else-colon-statement] 'endif' ';'
1116 if (token == TT_DDOT) {
1122 if (token == TT_DDOT) {
1126 if (token == TT_if) { //'else if'
1128 elseifStatementList();
1130 throwSyntaxError("':' expected after 'else'.");
1136 elseifStatementList();
1140 if (token != TT_endif) {
1141 throwSyntaxError("'endif' expected.");
1144 if (token != TT_SEMICOLON) {
1145 throwSyntaxError("';' expected after if-statement.");
1149 // statement [else-statement]
1151 if (token == TT_elseif) {
1153 if (token == TT_ARGOPEN) {
1156 throwSyntaxError("'(' expected after 'elseif' keyword.");
1159 if (token == TT_ARGCLOSE) {
1162 throwSyntaxError("')' expected after 'elseif' condition.");
1165 } else if (token == TT_else) {
1171 public void elseifStatementList() {
1177 if (token == TT_DDOT) {
1182 if (token == TT_if) { //'else if'
1185 throwSyntaxError("':' expected after 'else'.");
1198 public void elseifStatement() {
1199 if (token == TT_ARGOPEN) {
1202 if (token != TT_ARGOPEN) {
1203 throwSyntaxError("')' expected in else-if-statement.");
1206 if (token != TT_DDOT) {
1207 throwSyntaxError("':' expected in else-if-statement.");
1214 public void switchStatement() {
1215 if (token == TT_DDOT) {
1216 // ':' [labeled-statement-list] 'endswitch' ';'
1218 labeledStatementList();
1219 if (token != TT_endswitch) {
1220 throwSyntaxError("'endswitch' expected.");
1223 if (token != TT_SEMICOLON) {
1224 throwSyntaxError("';' expected after switch-statement.");
1228 // '{' [labeled-statement-list] '}'
1229 if (token != TT_LISTOPEN) {
1230 throwSyntaxError("'{' expected in switch statement.");
1233 if (token != TT_LISTCLOSE) {
1234 labeledStatementList();
1236 if (token != TT_LISTCLOSE) {
1237 throwSyntaxError("'}' expected in switch statement.");
1244 public void forStatement() {
1245 if (token == TT_DDOT) {
1248 if (token != TT_endfor) {
1249 throwSyntaxError("'endfor' expected.");
1252 if (token != TT_SEMICOLON) {
1253 throwSyntaxError("';' expected after for-statement.");
1261 public void whileStatement() {
1262 // ':' statement-list 'endwhile' ';'
1263 if (token == TT_DDOT) {
1266 if (token != TT_endwhile) {
1267 throwSyntaxError("'endwhile' expected.");
1270 if (token != TT_SEMICOLON) {
1271 throwSyntaxError("';' expected after while-statement.");
1279 public void foreachStatement() {
1280 if (token == TT_DDOT) {
1283 if (token != TT_endforeach) {
1284 throwSyntaxError("'endforeach' expected.");
1287 if (token != TT_SEMICOLON) {
1288 throwSyntaxError("';' expected after foreach-statement.");
1296 public void exitStatus() {
1297 if (token == TT_ARGOPEN) {
1300 throwSyntaxError("'(' expected in 'exit-status'.");
1302 if (token != TT_ARGCLOSE) {
1305 if (token == TT_ARGCLOSE) {
1308 throwSyntaxError("')' expected after 'exit-status'.");
1312 public void expressionList() {
1315 if (token == TT_COMMA) {
1323 public void expression() {
1324 // if (token == TT_STRING_CONSTANT || token == TT_INTERPOLATED_STRING) {
1327 logicalinclusiveorExpression();
1328 // while (token != TT_SEMICOLON) {
1334 public void postfixExpression() {
1336 boolean castFlag = false;
1338 case TT_STRING_CONSTANT :
1341 case TT_INTERPOLATED_STRING :
1346 if (token == TT_IDENTIFIER) {
1347 // check if identifier is a type:
1349 String str = identifier.toLowerCase();
1350 for (int i = 0; i < PHP_TYPES.length; i++) {
1351 if (PHP_TYPES[i].equals(str)) {
1358 if (token != TT_ARGCLOSE) {
1359 throwSyntaxError(") expected after cast-type '" + ident + "'.");
1369 if (token != TT_ARGCLOSE) {
1370 throwSyntaxError(") expected in postfix-expression.");
1374 case TT_DOUBLE_NUMBER :
1377 case TT_INT_NUMBER :
1383 if (token == TT_LISTOPEN) {
1386 if (token != TT_LISTCLOSE) {
1387 throwSyntaxError("'}' expected after variable '" + ident + "' in variable-expression.");
1392 case TT_IDENTIFIER :
1395 if (token == TT_ARGOPEN) {
1397 if (token != TT_ARGCLOSE) {
1399 if (token != TT_ARGCLOSE) {
1400 throwSyntaxError("')' expected after identifier '" + ident + "' in postfix-expression.");
1408 if (token == TT_ARGOPEN) {
1410 if (token == TT_COMMA) {
1414 if (token != TT_ARGCLOSE) {
1415 throwSyntaxError("')' expected after 'list' keyword.");
1418 // if (token == TT_SET) {
1420 // logicalinclusiveorExpression();
1423 throwSyntaxError("'(' expected after 'list' keyword.");
1428 // if (token == TT_ARGOPEN) {
1430 // if (token == TT_COMMA) {
1433 // expressionList();
1434 // if (token != TT_ARGCLOSE) {
1435 // throwSyntaxError("')' expected after 'list' keyword.");
1438 // if (token == TT_SET) {
1440 // logicalinclusiveorExpression();
1443 // throwSyntaxError("'(' expected after 'list' keyword.");
1447 boolean while_flag = true;
1453 if (token != TT_PARTCLOSE) {
1454 throwSyntaxError("] expected in postfix-expression.");
1463 case TT_IDENTIFIER :
1469 if (token != TT_LISTCLOSE) {
1470 throwSyntaxError("} expected in postfix-expression.");
1475 throwSyntaxError("Syntax error after '->' token.");
1486 } while (while_flag);
1489 public void unaryExpression() {
1499 //'&' '*' '+' '-' '~' '!'
1525 postfixExpression();
1529 public void castExpression() {
1530 // if (token == TT_ARGOPEN) {
1533 // if (token != TT_ARGCLOSE) {
1534 // throwSyntaxError(") expected after cast-expression.");
1541 public void typeName() {
1542 //'string' 'unset' 'array' 'object'
1544 //'real' 'double' 'float'
1547 if (token == TT_IDENTIFIER) {
1549 String str = identifier.toLowerCase();
1551 for (int i = 0; i < PHP_TYPES.length; i++) {
1552 if (PHP_TYPES[i].equals(str)) {
1557 throwSyntaxError("Expected type cast '( <type-name> )'; Got '" + ident + "'.");
1560 public void assignExpression() {
1562 if (token == TT_SET) { // =
1564 logicalinclusiveorExpression();
1565 } else if (token == TT_DOTASSIGN) { // .=
1567 logicalinclusiveorExpression();
1568 } else if (token == TT_FOREACH) { // =>
1570 logicalinclusiveorExpression();
1574 public void multiplicativeExpression() {
1577 if (token != TT_MULTIPLY && token != TT_DIV && token != TT_MOD) {
1584 public void concatenationExpression() {
1586 multiplicativeExpression();
1587 if (token != TT_DOT) {
1594 public void additiveExpression() {
1596 concatenationExpression();
1597 if (token != TT_ADD && token != TT_SUBTRACT) {
1604 public void shiftExpression() {
1606 additiveExpression();
1607 if (token != TT_LSHIFT && token != TT_RSHIFT) {
1614 public void relationalExpression() {
1617 if (token != TT_LESS && token != TT_GREATER && token != TT_LESSEQUAL && token != TT_GREATEREQUAL) {
1624 public void identicalExpression() {
1626 relationalExpression();
1627 if (token != TT_EX_EQUAL && token != TT_EX_UNEQUAL) {
1634 public void equalityExpression() {
1636 identicalExpression();
1637 if (token != TT_EQUAL && token != TT_UNEQUAL) {
1644 public void andExpression() {
1646 equalityExpression();
1647 if (token != TT_AMPERSAND) {
1654 public void exclusiveorExpression() {
1657 if (token != TT_POW) {
1664 public void inclusiveorExpression() {
1666 exclusiveorExpression();
1667 if (token != TT_LINE) {
1674 public void booleanandExpression() {
1676 inclusiveorExpression();
1677 if (token != TT_AND) {
1684 public void booleanorExpression() {
1686 booleanandExpression();
1687 if (token != TT_OR) {
1694 public void logicalandExpression() {
1696 booleanorExpression();
1697 if (token != TT_and) {
1704 public void logicalexclusiveorExpression() {
1706 logicalandExpression();
1707 if (token != TT_xor) {
1714 public void logicalinclusiveorExpression() {
1716 logicalexclusiveorExpression();
1717 if (token != TT_or) {
1724 // public void assignmentExpression() {
1725 // if (token == TT_VARIABLE) {
1727 // if (token == TT_SET) {
1729 // logicalinclusiveorExpression();
1732 // logicalinclusiveorExpression();
1736 public void variableList() {
1739 if (token == TT_COMMA) {
1747 public void variable() {
1748 if (token == TT_VARIABLE) {
1751 throwSyntaxError("$-variable expected in variable-list.");
1755 public void constant() {
1757 case TT_STRING_CONSTANT :
1760 case TT_INTERPOLATED_STRING :
1763 case TT_DOUBLE_NUMBER :
1766 case TT_INT_NUMBER :
1770 throwSyntaxError("Constant expected.");