Skip to content

Inconsistent grammar #2

Description

@myCrack

Comment defined as:

Comment ::= '#' [^\r\n]*

But parser works in different way, so some functions don't work. For example, this function

private bool IsStringOrComment() {
TreeBuilder.Node root = AST.AST.GetASTRoot();
bool notStringOrComment = true;
bool notReached = true;
void Traverse(TreeBuilder.Node node) {
if (node.children == null) {
if (notReached && node.begin < point.Position && node.end >= point.Position) {
if (node.name == "Comment" || (node.name == "String" && node.end != point.Position)) {
notStringOrComment = false;
}
notReached = false;
return;
}
return;
}
foreach (var child in node.children) {
Traverse(child);
}
}
Traverse(root);
return !notStringOrComment;
}

will generate wrong result if caret placed like this:

#                |

| - the caret.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions