From e216ae7dc757b169a033b48a74533e3ad1085ccd Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Wed, 29 May 2019 12:01:48 +0200 Subject: [PATCH] Cleanup grammar --- .../Analysis/AstCreationVisitor.cs | 4 ++-- .../Dsl/MessageContracts.g4 | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Abc.Zebus.MessageDsl/Analysis/AstCreationVisitor.cs b/src/Abc.Zebus.MessageDsl/Analysis/AstCreationVisitor.cs index a02272b..efc952e 100644 --- a/src/Abc.Zebus.MessageDsl/Analysis/AstCreationVisitor.cs +++ b/src/Abc.Zebus.MessageDsl/Analysis/AstCreationVisitor.cs @@ -133,7 +133,7 @@ public override AstNode VisitMessageDefinition(MessageDefinitionContext context) public override AstNode VisitParameterList(ParameterListContext context) { - foreach (var param in context.parameter().Select(Visit).OfType()) + foreach (var param in context.parameterDefinition().Select(Visit).OfType()) _currentMessage.Parameters.Add(param); return null; @@ -277,7 +277,7 @@ public override AstNode VisitTypeParamConstraint(TypeParamConstraintContext cont return constraint; } - private void ProcessMessage(MessageDefinition message, TypeDefinitionContext context) + private void ProcessMessage(MessageDefinition message, MessageDefinitionContext context) { try { diff --git a/src/Abc.Zebus.MessageDsl/Dsl/MessageContracts.g4 b/src/Abc.Zebus.MessageDsl/Dsl/MessageContracts.g4 index 0bea974..6db3d78 100644 --- a/src/Abc.Zebus.MessageDsl/Dsl/MessageContracts.g4 +++ b/src/Abc.Zebus.MessageDsl/Dsl/MessageContracts.g4 @@ -9,7 +9,7 @@ compileUnit definition : optionDefinition | usingDefinition - | typeDefinition + | messageDefinition | enumDefinition | SEP ; @@ -44,11 +44,11 @@ enumMember enumValue : enumValueAtom ( enumValueBinaryOp enumValue )* | '~' enumValue - | '(' enumValue ')' + | '(' enumValue ')' ; enumValueBinaryOp - : '|' | '&' | '^' | binaryShiftOp + : '|' | '&' | '^' | binaryShiftOp ; binaryShiftOp @@ -56,12 +56,12 @@ binaryShiftOp ; enumValueAtom - : id - | NUMBER + : id + | NUMBER ; -typeDefinition - : attributes messageName customModifier='!'? parameterList interfaceList typeParamConstraintList # messageDefinition +messageDefinition + : attributes messageName customModifier='!'? parameterList interfaceList typeParamConstraintList ; messageName @@ -73,11 +73,11 @@ interfaceList ; parameterList - : '(' (parameter (',' parameter)*)? ')' + : '(' (parameterDefinition (',' parameterDefinition)*)? ')' ; -parameter - : attributes typeName paramName=id optionalModifier='?'? ('=' defaultValue=literalValue)? # parameterDefinition +parameterDefinition + : attributes typeName paramName=id optionalModifier='?'? ('=' defaultValue=literalValue)? ; typeParamConstraintList