From 1cc0719c04267d78e0af5b4361331fde299a6087 Mon Sep 17 00:00:00 2001 From: vlamas Date: Tue, 9 Sep 2025 12:36:06 +0200 Subject: [PATCH] fix: correct constraint usage in parser and lexer definitions --- uvl/UVLLexer.g4 | 9 +++++---- uvl/UVLParser.g4 | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/uvl/UVLLexer.g4 b/uvl/UVLLexer.g4 index d308e8a..f015728 100644 --- a/uvl/UVLLexer.g4 +++ b/uvl/UVLLexer.g4 @@ -8,6 +8,7 @@ FEATURES_KEY: 'features'; IMPORTS_KEY: 'imports'; NAMESPACE_KEY: 'namespace'; AS_KEY: 'as'; +CONSTRAINT_KEY: 'constraint'; CONSTRAINTS_KEY: 'constraints'; CARDINALITY_KEY: 'cardinality'; STRING_KEY: 'String'; @@ -60,17 +61,17 @@ CLOSE_BRACE: '}'; OPEN_COMMENT: '/*'; CLOSE_COMMENT: '*/'; -FLOAT: '-'? [0-9]* [.][0-9]+; -INTEGER: '0' | '-'? [1-9][0-9]*; +FLOAT: '-'?[0-9]*[.][0-9]+; +INTEGER: '0' | '-'?[1-9][0-9]*; BOOLEAN: 'true' | 'false'; COMMA: ','; DOT: '.'; -ID_NOT_STRICT: '"' ~[\r\n".]+ '"'; +ID_NOT_STRICT: '"'~[\r\n".]+'"'; ID_STRICT: [a-zA-Z]([a-zA-Z0-9_#§%?\\'äüöß;])*; -STRING: '\'' ~[\r\n']+ '\''; +STRING: '\''~[\r\n'.]+'\''; SKIP_: ( SPACES | COMMENT) -> skip; diff --git a/uvl/UVLParser.g4 b/uvl/UVLParser.g4 index 831d380..528ca6a 100644 --- a/uvl/UVLParser.g4 +++ b/uvl/UVLParser.g4 @@ -44,7 +44,7 @@ value: BOOLEAN | FLOAT | INTEGER | STRING | attributes | vector; vector: OPEN_BRACK (value (COMMA value)*)? CLOSE_BRACK; constraintAttribute: - CONSTRAINTS_KEY constraint # SingleConstraintAttribute + CONSTRAINT_KEY constraint # SingleConstraintAttribute | CONSTRAINTS_KEY constraintList # ListConstraintAttribute; constraintList: OPEN_BRACK (constraint (COMMA constraint)*)? CLOSE_BRACK;