Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments after string literals #11

Open
zarubaf opened this issue Mar 21, 2020 · 0 comments
Open

Comments after string literals #11

zarubaf opened this issue Mar 21, 2020 · 0 comments

Comments

@zarubaf
Copy link
Collaborator

zarubaf commented Mar 21, 2020

sv-parser gobbles comments after String literals into its whitespace vector. Consequently, they are not stripped from the sources. A minimal example:

// General comment
module comment_module #(
    parameter blub = "blub"    // "blub" or "blub1"
) (
    // In body comment.
);

endmodule

Produces:

module blub_comment_module #(
    parameter blub = "blub"    // "blub" or "blub1"
) (
    
);

endmodule

Expect:

module blub_comment_module #(
    parameter blub = "blub" 
) (
    
);

endmodule

Preprocessed syntax tree:

PreprocessorText { nodes: ([Comment(Comment { nodes: (Locate { offset: 0, line: 1, len: 18 },) }), NotDirective(SourceDescriptionNotDirective { nodes: (Locate { offset: 18, line: 1, len: 47 },) }), StringLiteral(StringLiteral { nodes: (Locate { offset: 65, line: 3, len: 6 }, [Space(Locate { offset: 71, line: 3, len: 4 }), Comment(Comment { nodes: (Locate { offset: 75, line: 3, len: 20 },) }), Space(Locate { offset: 95, line: 3, len: 1 })]) }), NotDirective(SourceDescriptionNotDirective { nodes: (Locate { offset: 96, line: 4, len: 8 },) }), Comment(Comment { nodes: (Locate { offset: 104, line: 5, len: 19 },) }), NotDirective(SourceDescriptionNotDirective { nodes: (Locate { offset: 123, line: 5, len: 43 },) })],) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant