tree-sitter-java icon indicating copy to clipboard operation
tree-sitter-java copied to clipboard

Parsing escape sequences does not always work

Open ahumenberger opened this issue 1 year ago • 1 comments

The following piece of code currently produces the syntax tree below. Notice that the escape sequence for \s is just swallowed.

I guess the solution is that the allowed characters for escape sequences needs to be extended by characters allowed in regular expressions?!

String s = """
  \n abc
  \s def
""";
program [0, 0] - [4, 0]
  local_variable_declaration [0, 0] - [3, 4]
    type: type_identifier [0, 0] - [0, 6]
    declarator: variable_declarator [0, 7] - [3, 3]
      name: identifier [0, 7] - [0, 8]
      value: string_literal [0, 11] - [3, 3]
        multiline_string_fragment [0, 14] - [1, 2]
        escape_sequence [1, 2] - [1, 4]
        multiline_string_fragment [1, 4] - [2, 2]
        multiline_string_fragment [2, 4] - [3, 0]

ahumenberger avatar Sep 04 '23 10:09 ahumenberger