Gamend.GDScript.Lexer (gamend_plugin_tools v1.0.1196)

Copy Markdown View Source

GDScript source text into a flat token list.

Indentation is significant in GDScript, so the lexer is line-oriented: it tracks an indent stack and emits :indent / :dedent tokens, the same shape a Python lexer produces. Everything downstream then works on a flat stream with explicit block delimiters.

A token is {type, value, line}. Types:

  • :ident :int :float :string — literals and names
  • :keyword — a reserved word (func, var, if, …)
  • :op — an operator or delimiter
  • :newline :indent :dedent :eof — structure

Blank lines and comment-only lines produce no tokens at all, and newlines inside brackets are swallowed so a call can wrap across lines.

Summary

Functions

tokenize(source, file \\ "nofile")

@spec tokenize(String.t(), String.t()) :: [tuple()]

Tokenize source. Raises Gamend.GDScript.CompileError on bad input.