Skip to content

Add COMMENT tokens to the parser and AST #881

Description

@purpleidea

In our lexer (in lexer.nex) we drop all the comments found. This made it easier to write the parser, and is common practice, but we actually need to parse them if we want to eventually have an mgmt fmt type tool that prints out the parsed AST.

As a result, we'd like to add them in wherever they are needed to parser.y. If you are a yacc or goyacc expert, we'd appreciate the help! If you can do this in a minimally invasive way, such that it doesn't make the whole thing wholly unreadable, that would be lovely.

This will need a bunch of new tests in TestAstFunc1/ or TestAstFunc2/ or perhaps it's even better to have a TestAstFuncX that is specialized for looking at parsed AST shape?

Once this is done, we can "print" out the AST to get back the original source (or our formatted version of it of course!)

A future step is removing the required trailing comma on single line lists and similar...

Metadata

Metadata

Assignees

No one assigned

    Labels

    hackerThis will require expert use of golang, mgmt, concurrency, algorithms, or even complicated testing.help wanted

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions