Skip to content

Commit

Permalink
Bug: parsing of multi-line comment ending with 2 stars (#104)
Browse files Browse the repository at this point in the history
Issue-72 - Bug: parsing of multi-line comment ending with 2 stars
  • Loading branch information
ldenisey authored Dec 24, 2023
1 parent 8d320fe commit 09506c0
Show file tree
Hide file tree
Showing 9 changed files with 1,645 additions and 1,554 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
### Removed

### Fixed

- Changelog plugin configuration
- [PR-104](https://github.com/ldenisey/idea-openscad/pull/104) Bug: parsing of multi-line comment ending with 2 stars

## 2.4.0

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ intellij {
}

// For parser debugging only
//plugins.add('psiviewer:223-SNAPSHOT')
//plugins.add('psiviewer:232.2')
}

runPluginVerifier {
Expand Down
2,685 changes: 1,390 additions & 1,295 deletions src/main/gen/com/javampire/openscad/lexer/OpenSCADLexer.java

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions src/main/java/com/javampire/openscad/lexer/idea-flex.skeleton
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,9 @@
from input */
private int zzEndRead;

/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;

/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;

/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;

--- user class code

--- constructor declaration
Expand Down
Binary file not shown.
Binary file not shown.
21 changes: 8 additions & 13 deletions src/main/java/com/javampire/openscad/lexer/openscad.flex
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,14 @@ IMPORT_COND={WHITE_SPACE}*"<"
IMPORT_PATH=[^<>]+

BUILTIN_COND={WHITE_SPACE}*"("
BUILTIN_OVERRIDABLE_COND={WHITE_SPACE}*[^(]

COMMENT_MULTILINE_C_STYLE_START="/*"
COMMENT_MULTILINE_DOC_START="/**"
COMMENT_MULTILINE_CONTENT=([^"*"]*("*"+[^"*""/"])?)* // = whatever string except "*/"
COMMENT_MULTILINE_END="*/"
COMMENT_SINGLELINE_START="//"

COMMENT_CUSTOMIZER_VALUE={COMMENT_SINGLELINE_START}{BLANK}*"["[a-zA-Z0-9:, -]+"]"
COMMENT_CUSTOMIZER_TABS={COMMENT_MULTILINE_C_STYLE_START}{BLANK}*"["[a-zA-Z0-9:, -]+"]"{BLANK}*{COMMENT_MULTILINE_END}
COMMENT_C_STYLE={COMMENT_MULTILINE_C_STYLE_START}{COMMENT_MULTILINE_CONTENT}{COMMENT_MULTILINE_END}
COMMENT_DOC={COMMENT_MULTILINE_DOC_START}{COMMENT_MULTILINE_CONTENT}{COMMENT_MULTILINE_END}
COMMENT_SINGLELINE={COMMENT_SINGLELINE_START}[^\r\n]*

COMMENT_CUSTOMIZER_CONTENT="["[a-zA-Z0-9:, -]+"]"
COMMENT_CUSTOMIZER_VALUE="//"{BLANK}*{COMMENT_CUSTOMIZER_CONTENT}
COMMENT_CUSTOMIZER_TABS="/*"{BLANK}*{COMMENT_CUSTOMIZER_CONTENT}{BLANK}*"*/"
COMMENT_MULTILINE_CONTENT=[^*]*\*+([^/*][^*]*\*+)* // = whatever string except "*/"
COMMENT_C_STYLE="/*"{COMMENT_MULTILINE_CONTENT}"/"
COMMENT_DOC="/**"{COMMENT_MULTILINE_CONTENT}"/"
COMMENT_SINGLELINE="//"[^\r\n]*
COMMENT_SINGLELINE_BLOCK={COMMENT_SINGLELINE}({CRLF}{COMMENT_SINGLELINE})+

IDENTIFIER = [a-zA-Z0-9_$]+
Expand Down
3 changes: 3 additions & 0 deletions src/test/testData/openscad/parser/base/comment.scad
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/

// https://github.com/ldenisey/idea-openscad/issues/72
/* **/

// Single line comment can be chained and folded together
// Customizer parameters
/* [Drop down box:] */
Expand Down
478 changes: 241 additions & 237 deletions src/test/testData/openscad/parser/base/comment_psidump.txt

Large diffs are not rendered by default.

0 comments on commit 09506c0

Please sign in to comment.