Skip to content

Discretionary parsing of source code - how to ignore parts I don't need? #4212

Closed Answered by kaby76
raffian asked this question in Q&A
Discussion options

You must be logged in to vote

Essentially, the C.g4 grammar itself has multiple occurrences of the string literal '__extension__'. That's why you see multiple strings outputted by the command.

$ grep __extension__ C.g4
    |   '__extension__'? '(' compoundStatement ')' // Blocks (GCC extension)
    |   '__extension__'? '(' typeName ')' '{' initializerList ','? '}'
    :   '__extension__'? '(' typeName ')' castExpression
    |   '__extension__' '(' ('__m128' | '__m128d' | '__m128i') ')'

Trash is a command-line toolkit that parses input, passes parse trees around, and analyzes parse trees. An Antlr4 grammar is parsed just as any input, but with the antlr/antlr4/ grammar. The output of commands in the toolkit are parse …

Replies: 8 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@raffian
Comment options

Comment options

You must be logged in to vote
1 reply
@raffian
Comment options

Comment options

You must be logged in to vote
1 reply
@raffian
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@raffian
Comment options

@raffian
Comment options

@kaby76
Comment options

Answer selected by raffian
@raffian
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@raffian
Comment options

Comment options

You must be logged in to vote
4 replies
@kaby76
Comment options

@raffian
Comment options

@kaby76
Comment options

@raffian
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants