Skip to content

Commit 3259ae1

Browse files
committed
Fix regex of multiline comment
1 parent 306cca8 commit 3259ae1

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

crates/parser/src/generated/veryl-exp.par

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
%%
3434

35-
/* 0 */ CommentsTerm: <INITIAL, Generic, Attr>"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*(?:[^*]|\*[^/])*\*/))\s*)+" : Token;
35+
/* 0 */ CommentsTerm: <INITIAL, Generic, Attr>"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*/?([^/]|[^*]/)*\*/))\s*)+" : Token;
3636
/* 1 */ StringLiteralTerm: <INITIAL, Generic, Attr>"\u{0022}(?:\\[\u{0022}\\/bfnrt]|u[0-9a-fA-F]{4}|[^\u{0022}\\\u0000-\u001F])*\u{0022}" : Token;
3737
/* 2 */ ExponentTerm: <INITIAL, Generic>/[0-9]+(?:_[0-9]+)*\.[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*/ : Token;
3838
/* 3 */ FixedPointTerm: <INITIAL, Generic>/[0-9]+(?:_[0-9]+)*\.[0-9]+(?:_[0-9]+)*/ : Token;

crates/parser/src/generated/veryl_grammar_trait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6939,7 +6939,7 @@ pub struct CommentsOpt {
69396939
#[allow(dead_code)]
69406940
#[derive(Debug, Clone)]
69416941
pub struct CommentsTerm {
6942-
pub comments_term: crate::veryl_token::Token, /* (?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*(?:[^*]|\*[^/])*\*\/))\s*)+ */
6942+
pub comments_term: crate::veryl_token::Token, /* (?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*\/?([^/]|[^*]/)*\*\/))\s*)+ */
69436943
}
69446944

69456945
///
@@ -14440,7 +14440,7 @@ impl<'t, 'u> VerylGrammarAuto<'t, 'u> {
1444014440

1444114441
/// Semantic action for production 0:
1444214442
///
14443-
/// `CommentsTerm: <INITIAL, Generic, Attr>"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*(?:[^*]|\*[^/])*\*/))\s*)+" : Token;`
14443+
/// `CommentsTerm: <INITIAL, Generic, Attr>"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*/?([^/]|[^*]/)*\*/))\s*)+" : Token;`
1444414444
///
1444514445
#[parol_runtime::function_name::named]
1444614446
fn comments_term(&mut self, comments_term: &ParseTreeType<'t>) -> Result<()> {

crates/parser/src/generated/veryl_parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ scanner! {
162162
mode INITIAL {
163163
token r"\r\n|\r|\n" => 1; // "Newline"
164164
token r"[\s--\r\n]+" => 2; // "Whitespace"
165-
token r"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*(?:[^*]|\*[^/])*\*/))\s*)+" => 5; // "CommentsTerm"
165+
token r"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*/?([^/]|[^*]/)*\*/))\s*)+" => 5; // "CommentsTerm"
166166
token r"\u{0022}(?:\\[\u{0022}\\/bfnrt]|u[0-9a-fA-F]{4}|[^\u{0022}\\\u0000-\u001F])*\u{0022}" => 6; // "StringLiteralTerm"
167167
token r"[0-9]+(?:_[0-9]+)*\.[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*" => 7; // "ExponentTerm"
168168
token r"[0-9]+(?:_[0-9]+)*\.[0-9]+(?:_[0-9]+)*" => 8; // "FixedPointTerm"
@@ -320,7 +320,7 @@ scanner! {
320320
mode Generic {
321321
token r"\r\n|\r|\n" => 1; // "Newline"
322322
token r"[\s--\r\n]+" => 2; // "Whitespace"
323-
token r"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*(?:[^*]|\*[^/])*\*/))\s*)+" => 5; // "CommentsTerm"
323+
token r"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*/?([^/]|[^*]/)*\*/))\s*)+" => 5; // "CommentsTerm"
324324
token r"\u{0022}(?:\\[\u{0022}\\/bfnrt]|u[0-9a-fA-F]{4}|[^\u{0022}\\\u0000-\u001F])*\u{0022}" => 6; // "StringLiteralTerm"
325325
token r"[0-9]+(?:_[0-9]+)*\.[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*" => 7; // "ExponentTerm"
326326
token r"[0-9]+(?:_[0-9]+)*\.[0-9]+(?:_[0-9]+)*" => 8; // "FixedPointTerm"
@@ -433,7 +433,7 @@ scanner! {
433433
mode Attr {
434434
token r"\r\n|\r|\n" => 1; // "Newline"
435435
token r"[\s--\r\n]+" => 2; // "Whitespace"
436-
token r"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*(?:[^*]|\*[^/])*\*/))\s*)+" => 5; // "CommentsTerm"
436+
token r"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*/?([^/]|[^*]/)*\*/))\s*)+" => 5; // "CommentsTerm"
437437
token r"\u{0022}(?:\\[\u{0022}\\/bfnrt]|u[0-9a-fA-F]{4}|[^\u{0022}\\\u0000-\u001F])*\u{0022}" => 6; // "StringLiteralTerm"
438438
token r"," => 33; // "CommaTerm"
439439
token r"\{" => 46; // "LBraceTerm"
@@ -33318,7 +33318,7 @@ pub const LOOKAHEAD_AUTOMATA: &[LookaheadDFA; 787] = &[
3331833318
];
3331933319

3332033320
pub const PRODUCTIONS: &[Production; 1143] = &[
33321-
// 0 - CommentsTerm: "(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*(?:[^*]|\*[^/])*\*/))\s*)+";
33321+
// 0 - CommentsTerm: "(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*/?([^/]|[^*]/)*\*/))\s*)+";
3332233322
Production {
3332333323
lhs: 122,
3332433324
production: &[ParseType::T(5)],

crates/parser/veryl.par

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
// Longest match should be first
4747

48-
CommentsTerm : <INITIAL, Generic, Attr>"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*(?:[^*]|\*[^/])*\*/))\s*)+" : Token;
48+
CommentsTerm : <INITIAL, Generic, Attr>"(?:(?:(?://.*(?:\r\n|\r|\n)?)|(?:(?ms)/\*/?([^/]|[^*]/)*\*/))\s*)+" : Token;
4949
StringLiteralTerm : <INITIAL, Generic, Attr>"\u{0022}(?:\\[\u{0022}\\/bfnrt]|u[0-9a-fA-F]{4}|[^\u{0022}\\\u0000-\u001F])*\u{0022}": Token;
5050
ExponentTerm : <INITIAL, Generic >/[0-9]+(?:_[0-9]+)*\.[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*/ : Token;
5151
FixedPointTerm : <INITIAL, Generic >/[0-9]+(?:_[0-9]+)*\.[0-9]+(?:_[0-9]+)*/ : Token;

0 commit comments

Comments
 (0)