forked from beanshell/beanshell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request beanshell#754 from beanshell/fix_753
Fix parser errors handling multi-line comments beanshell#753
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/java bsh.Interpreter | ||
|
||
source("TestHarness.bsh"); | ||
source("Assert.bsh"); | ||
|
||
import bsh.*; | ||
|
||
/** | ||
* test that formal comments are picked up as nodes, and other types of comments are skipped | ||
*/ | ||
|
||
/* | ||
* This comment should be skipped | ||
*/ | ||
|
||
/********************************** | ||
* This comment should be skipped | ||
**********************************/ | ||
|
||
// This comment should be skipped | ||
|
||
parser = new Parser(new FileReader(bsh.cwd+"/"+getSourceFileInfo())); | ||
parser.setRetainComments(true); | ||
|
||
assertFalse("parse line 1", parser.Line()); | ||
assertEquals("node 1 class", BSHAssignment.class, parser.popNode().getClass()); | ||
assertFalse("parse line 2", parser.Line()); | ||
assertEquals("node 2 class", BSHAssignment.class, parser.popNode().getClass()); | ||
assertFalse("parse line 3", parser.Line()); | ||
assertEquals("node 3 class", BSHImportDeclaration.class, parser.popNode().getClass()); | ||
assertFalse("parse line 4", parser.Line()); | ||
assertEquals("node 4 class", BSHFormalComment.class, parser.popNode().getClass()); | ||
assertFalse("parse line 5", parser.Line()); | ||
assertEquals("node 5 class", BSHAssignment.class, parser.popNode().getClass()); | ||
|
||
complete(); |