Skip to content

bump_glue next_byte disregard num_tokens #331

@sunxd3

Description

@sunxd3

MWE:

julia> ps = ParseStream("a + b - c * d"); peek(ps);

julia> bump_glue(ps, K"Identifier", EMPTY_FLAGS, 4)
JuliaSyntax.ParseStreamPosition(0x00000002, 0x00000000)

julia> ps.tokens[end] |> dump
JuliaSyntax.SyntaxToken
  head: JuliaSyntax.SyntaxHead
    kind: JuliaSyntax.Kind K"Identifier"
    flags: UInt16 0x0000
  orig_kind: JuliaSyntax.Kind K"Identifier"
  preceding_whitespace: Bool false
  next_byte: UInt32 0x00000003

If I understand correctly, I would expect the next_byte to be 0x00000006 as,

julia> JuliaSyntax.peek_token(ps)
Identifier      |6

Maybe at

stream.lookahead[i+1].next_byte))

should be

                                     stream.lookahead[i+num_tokens].next_byte))

and maybe bound checking?

This effects build_tree as

stream.tokens[end].next_byte - 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions