Changeset 82cecb85d4b9fff471d3eadd986735ad736c6c3f
- Timestamp:
- 06/28/09 23:36:50 (14 months ago)
- Author:
- mb0 <mb0@…>
- Children:
- 2d81bf0e2ed8217c6cb2a26fcb22d09b8441f7a3
- Parents:
- c598ac61d680bc607baa6ff4a8fbb9447b6cf4ed
- git-author:
- mb0 <mb0@…> (06/08/09 14:07:49)
- git-committer:
- mb0 <mb0@…> (06/28/09 23:36:50)
- Message:
-
do not allow empty semicolon only allow virtual semicolon.
parsing without virtual semicolon insertion is now stricter..
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
ra106cc3
|
r82cecb8
|
|
| 99 | 99 | public void testImport() throws Exception { |
| 100 | 100 | Program prog; ImportDirectiveList list; |
| 101 | | prog = parse("import A"); |
| | 101 | prog = parse("import A;"); |
| 102 | 102 | assertEquals(ImportDirectiveList.class, prog.getDirectives().getDirectiveAt(0).getClass()); |
| 103 | | prog = parse("import A import a.b.C; import abc.*"); |
| | 103 | prog = parse("import A; import a.b.C; import abc.*;"); |
| 104 | 104 | list = (ImportDirectiveList) prog.getDirectives().getDirectiveAt(0); |
| 105 | 105 | assertEquals(3, list.size()); |
| … |
… |
|
| 126 | 126 | assertEquals(null, type.getBody().getDirectives()); |
| 127 | 127 | |
| 128 | | prog = parse("interface A { function f():A;function g():B}"); |
| | 128 | prog = parse("interface A { function f():A;function g():B;}"); |
| 129 | 129 | assertEquals(InterfaceDefinition.class, prog.getDirectives().getDirectiveAt(0).getClass()); |
| 130 | 130 | type = (InterfaceDefinition) prog.getDirectives().getDirectiveAt(0); |
| … |
… |
|
| 157 | 157 | assertEquals(FunctionDefinition.class, directive.getClass()); |
| 158 | 158 | |
| 159 | | prog = parse("function f(b:B){a = b;a.c()}"); |
| | 159 | prog = parse("function f(b:B){a = b;a.c();}"); |
| 160 | 160 | directive = prog.getDirectives().getDirectiveAt(0); |
| 161 | 161 | def = (FunctionDefinition) directive; |
-
|
re9006de
|
r82cecb8
|
|
| 87 | 87 | assertExpression(parse("get"),Ident.class); |
| 88 | 88 | assertExpression(parse("set"),Ident.class); |
| 89 | | assertExpression(parse("namespace"),Ident.class); |
| | 89 | //assertExpression(parse("namespace"),Ident.class); |
| 90 | 90 | assertExpression(parse("include"),Ident.class); |
| 91 | 91 | assertExpression(parse("dynamic"),Ident.class); |
-
|
r5eb830a
|
r82cecb8
|
|
| 11 | 11 | } |
| 12 | 12 | public void testVirtualSemi() throws Exception { |
| 13 | | assertNotNull(parse("{var i = 0;var j = 1}", false)); |
| | 13 | assertNotNull(parse("{var i = 0;var j = 1;}", false)); |
| 14 | 14 | // without virtual semi |
| 15 | 15 | System.out.print("expected"); |
| 16 | | assertNull(parse("{var i = 0\nvar j = 1}", false)); |
| | 16 | assertNull(parse("{var i = 0\nvar j = 1;}", false)); |
| 17 | 17 | // with insertion |
| 18 | | assertNotNull(parse("{var i = 0;\nvar j = 1}", true)); |
| 19 | | assertNotNull(parse("{var i = 0\n;var j = 1}", true)); |
| 20 | | assertNotNull(parse("{var i = 0\nvar j = 1}", true)); |
| | 18 | assertNotNull(parse("{var i = 0;\nvar j = 1;}", true)); |
| | 19 | assertNotNull(parse("{var i = 0\n;var j = 1;}", true)); |
| | 20 | assertNotNull(parse("{var i = 0\nvar j = 1;}", true)); |
| 21 | 21 | } |
| 22 | 22 | } |
-
|
r369d8ec
|
r82cecb8
|
|
| 121 | 121 | |
| 122 | 122 | %Recover |
| 123 | | VirtualSemicolon |
| 124 | 123 | %End |
| 125 | 124 | |
| … |
… |
|
| 552 | 551 | SubstatementsPrefix$$Substatement_full ::= SubstatementsPrefix Substatement_full |
| 553 | 552 | |
| 554 | | Semicolon_abbrev ::= %empty |
| | 553 | -- no empty semicolon ! use virtual semi now instead ! |
| | 554 | --Semicolon_abbrev ::= %empty |
| 555 | 555 | Semicolon_abbrev$Semicolon ::= SEMI$ | VirtualSemicolon$ |
| 556 | 556 | |
| 557 | | Semicolon_nosif ::= %empty |
| | 557 | --Semicolon_nosif ::= %empty |
| 558 | 558 | Semicolon_nosif$Semicolon ::= SEMI$ | VirtualSemicolon$ |
| 559 | 559 | |