Skip to content

Commit a3abb44

Browse files
author
reidspencer
committed
Expand the definition of nonKeywordChars to include - and _ as they are never used in keywords but might be in identifiers.
1 parent 7a1a1cc commit a3abb44

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • language/shared/src/main/scala/com/ossuminc/riddl/language/parsing

language/shared/src/main/scala/com/ossuminc/riddl/language/parsing/Keywords.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import java.lang.Character.{isLetter, isWhitespace}
1616
*/
1717
object Keywords {
1818

19-
private val nonKeywordChars = (c: Char) => !isLetter(c)
19+
// A keyword must be followed by a non-identifier character (not a letter, digit, hyphen, or underscore)
20+
// This prevents "event" from matching in "event-sourced" or "type_id"
21+
private val nonKeywordChars = (c: Char) => !isLetter(c) && c != '-' && c != '_' && !c.isDigit
2022

2123
// Succeeds if the next character (look ahead without consuming) is not an
2224
// identifier character. This is used with keywords to make sure the keyword

0 commit comments

Comments
 (0)