Hi all So I am writing a parser and I have ran into the issue where I am getting ambiguity as I have 2 rules that are causing the ambiguity one is related to user_defined_types and the other is related to record_names
so let me break it down
in the data I am trying to parse a user can define there own type I capture that correctly but then when I am trying to identify a user defined type in the parser I have to look for the form CNAME CNAME which in lark is defined as
DIGIT: "0".."9"
LCASE_LETTER: "a".."z"
UCASE_LETTER: "A".."Z"
LETTER: UCASE_LETTER | LCASE_LETTER
CNAME: ("_"|LETTER) ("_"|LETTER|DIGIT)*
ok so user_defined_type in my data come in the form of 2 seperate CNAMES so an example would be userDefinedType userDefinedTypeName
then trying to find the record_name in the parser, that rule is of the form
record_name: "end" CNAME
as the record name is capture at the end of the record when the record is closed and the name follows the keyword "end" end is a keyword in the data I am trying to parse
The issue with the ambiguity falls into the fact that an example of a record name so => end myRecord
this also falls into the user_defined_type rule and it falls into the record_name rule so that is where we get 2 seperate trees the ambiguity I want it to only fall into the record_name rule and not the user_defined_type rule
Is there a way I can modify CNAME to identify all strings except "end" or is there a way I can add a different regex into my user_defined_type to check that the first string is not = end
so change user_defined_type: NOT_END CNAME
can anyone propose what is best to do and how to write a regex that matches all string apart from end
Thanks