-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Soft Parser: Initial implementation of SoftParser
#328
Conversation
Sound's good to me |
I translated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work
Lexème sounds better in French 😆 |
Overview
CodeProvider
execution (completion, goto definition etc) #104.SoftParser
.Syntax error-insensitive
SoftParser
always generates an AST, even if the code contains syntax errors. This ensures that LSP APIs (jump-to-definition, code completion etc) are always available.Unresolved
in the Syntax Tree.Order-insensitive
The order of the code is not enforced. For example, the following code is parseable:
Releases & Incremental implementation
Being error-insensitive allows
SoftParser
to be implemented and integrated incrementally. For example, the following is valid Ralph code, butlet bool = true
is parsed asUnresolved
bySoftParser
because it does not recognise this syntax yet.ralph-lsp
with the latestNode
version.SoftParser
to used by jump-definitions, code-completion etc, even though it is only partially implemented.Convert
SoftAST
to CodeSoftAST
can always be converted back to the original string code using thetoCode()
method call:toCode()
can be also be invoked on any sub-tree, resulting in code just for that tree.See Demo.scala.
Formatting
SoftAST.Space
instances within anAST
.SoftParser
does not enforce strict ordering. For example,fn function()
is parsable even when it is not embedded within aContract
orTxScript
. This allows the implementation of on type formatting.AST as
String
Invoke the following to generate a String tree representation of the AST.
See Demo.scala.
Next steps