Different kinds of lexemes can be coloured differently on the website
concrete concepts e.g. let
abstract concepts e.g. and
new concepts e.g. new_concept
variable concepts e.g. _x_
unmatched parentheses
matched parentheses
This is possible by exposing a new public method for Context called lex which takes the command as a &str and returning a Vec<Lexeme> this can be used in front ends such as the zia-lang.org website to provide syntax colouring. The current implementation involves duplicated logic that's used in Context::ast_from_expression this is due a refactor that should be a separate PR.
The website callsContext::lexon every render to lex the whole command. For better performance, there should be a method to update the Vec<Lexeme> based on the change in the command as the user types.
This is first step of the solution of #52
Different kinds of lexemes can be coloured differently on the website
let
and
new_concept
_x_
This is possible by exposing a new public method for
Context
calledlex
which takes the command as a&str
and returning aVec<Lexeme>
this can be used in front ends such as the zia-lang.org website to provide syntax colouring. The current implementation involves duplicated logic that's used inContext::ast_from_expression
this is due a refactor that should be a separate PR.The website calls
Context::lex
on every render to lex the whole command. For better performance, there should be a method to update theVec<Lexeme>
based on the change in the command as the user types.