Skip to content

Commit

Permalink
Cleanup grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrzesniewski committed May 29, 2019
1 parent 4a55db5 commit e216ae7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Abc.Zebus.MessageDsl/Analysis/AstCreationVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ParameterDefinition>())
foreach (var param in context.parameterDefinition().Select(Visit).OfType<ParameterDefinition>())
_currentMessage.Parameters.Add(param);

return null;
Expand Down Expand Up @@ -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
{
Expand Down
20 changes: 10 additions & 10 deletions src/Abc.Zebus.MessageDsl/Dsl/MessageContracts.g4
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ compileUnit
definition
: optionDefinition
| usingDefinition
| typeDefinition
| messageDefinition
| enumDefinition
| SEP
;
Expand Down Expand Up @@ -44,24 +44,24 @@ enumMember
enumValue
: enumValueAtom ( enumValueBinaryOp enumValue )*
| '~' enumValue
| '(' enumValue ')'
| '(' enumValue ')'
;

enumValueBinaryOp
: '|' | '&' | '^' | binaryShiftOp
: '|' | '&' | '^' | binaryShiftOp
;

binaryShiftOp
: { AreTwoNextTokensConsecutive() }? ( '<' '<' | '>' '>' )
;

enumValueAtom
: id
| NUMBER
: id
| NUMBER
;

typeDefinition
: attributes messageName customModifier='!'? parameterList interfaceList typeParamConstraintList # messageDefinition
messageDefinition
: attributes messageName customModifier='!'? parameterList interfaceList typeParamConstraintList
;

messageName
Expand All @@ -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
Expand Down

0 comments on commit e216ae7

Please sign in to comment.