Skip to content
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

Use Rust Parser from Java instead of AST.scala #3611

Merged
merged 325 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
325 commits
Select commit Hold shift + click to select a range
e750fc7
Parser multiargument function signature and deferred argument
JaroslavTulach Sep 29, 2022
f7d7fdc
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Sep 29, 2022
eae820f
Removing comment handling for now
JaroslavTulach Sep 30, 2022
a5df97d
Handle doc comments without failing
JaroslavTulach Sep 30, 2022
3b93f7f
Parse case_of expressions
JaroslavTulach Sep 30, 2022
ca8f921
Support for _ in case_of
JaroslavTulach Sep 30, 2022
d977637
Merging with develop branch
JaroslavTulach Sep 30, 2022
5a5fa7b
Wildcard can be also on field name identifier
JaroslavTulach Sep 30, 2022
9ec0bdc
More complex type signatures
JaroslavTulach Oct 3, 2022
620135c
Parsing vector literals
JaroslavTulach Oct 3, 2022
72461d0
Parse named arguments
JaroslavTulach Oct 3, 2022
7adc9a2
QualifiedName in case pattern match
JaroslavTulach Oct 3, 2022
616772c
Lines may not represent expression
JaroslavTulach Oct 3, 2022
5a46217
Suppress warnings
JaroslavTulach Oct 3, 2022
4d8b1e2
Default arguments for max_rows parsed
JaroslavTulach Oct 3, 2022
5b9bc50
Merge commit 'c460b7c4a4f19642a51442820b07f33658f783de' into wip/jtul…
JaroslavTulach Oct 5, 2022
5ecbf92
Merge with recent Kaz's work
JaroslavTulach Oct 5, 2022
9e8a59b
Uncurry multiple functions into one
JaroslavTulach Oct 5, 2022
021ba11
Compatible with previously working tests
JaroslavTulach Oct 5, 2022
a50c69e
Whitespace trimming isn't needed for identifiers
JaroslavTulach Oct 5, 2022
cc6ef57
Compile without ParserSyntaxException
JaroslavTulach Oct 5, 2022
4525b82
Merge branch 'develop' into wip/jtulach/UseRustParserFromJava_182743471
JaroslavTulach Oct 6, 2022
5559bdc
Merge with origin/develop
JaroslavTulach Oct 6, 2022
95ca7a0
Merge branch 'wip/jtulach/UseRustParserFromJava_182743471' of enso:en…
JaroslavTulach Oct 6, 2022
7438633
Handle Tree.Function inside of another function
JaroslavTulach Oct 6, 2022
7811dc7
Some support for operators that need to be translated to lambdas
JaroslavTulach Oct 6, 2022
b375152
If there is an Invalid entity, then the Rust parser failed
JaroslavTulach Oct 6, 2022
283fea1
Missing pattern for Case signals unsupported case_type_of syntax
JaroslavTulach Oct 6, 2022
ca421ba
Annotations aren't supported so far
JaroslavTulach Oct 6, 2022
2baff87
Support unary minus
JaroslavTulach Oct 6, 2022
d967307
Support for text literal in case_of statement
JaroslavTulach Oct 6, 2022
748009f
Support for extension methods
JaroslavTulach Oct 6, 2022
519594c
Inner function with type signature
JaroslavTulach Oct 6, 2022
a61ad40
Merging Kaz's PR-3773
JaroslavTulach Oct 7, 2022
df0999e
translateArgumentsDefinition takes no arguments any longer
JaroslavTulach Oct 7, 2022
788e079
Some support for template functions
JaroslavTulach Oct 7, 2022
fbfa007
IR differs based on lowercase/uppercase of the identifier
JaroslavTulach Oct 7, 2022
b4d3caa
Compare old and new IR of all library files
JaroslavTulach Oct 7, 2022
07dbb86
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 7, 2022
6a51a63
Merging support for @annotation on Rust side
JaroslavTulach Oct 10, 2022
ace5cd8
Basic support for converting @annotation to IR
JaroslavTulach Oct 10, 2022
404527e
Support for @Builtin_Type
JaroslavTulach Oct 10, 2022
156edae
Multi-parameter annotation and a block annotation
JaroslavTulach Oct 10, 2022
7ce4808
Merge branch 'develop' into wip/jtulach/UseRustParserFromJava_182743471
JaroslavTulach Oct 10, 2022
b0520c4
Avoid NPE in LoadParser.java
JaroslavTulach Oct 10, 2022
39b9266
Display failed, as well as irFailed errors
JaroslavTulach Oct 10, 2022
3fd8a6d
Merging with annotations work from the develop branch
JaroslavTulach Oct 11, 2022
9efc620
Removing unwanted differences with develop branch
JaroslavTulach Oct 11, 2022
2909a51
Sanitize the self name
JaroslavTulach Oct 11, 2022
3e03e7d
Support type methods
JaroslavTulach Oct 11, 2022
fda957a
Eliminate comments from bindings
JaroslavTulach Oct 11, 2022
51efba9
Recognize operator by not having alphanumeric characters
JaroslavTulach Oct 11, 2022
fc04b32
Parses Boolean type
JaroslavTulach Oct 11, 2022
535570f
Try harder to remove all documentation comments from comparations
JaroslavTulach Oct 11, 2022
4cf7c78
Recognize eq_at function definition
JaroslavTulach Oct 11, 2022
2384056
Text or Nothing type
JaroslavTulach Oct 11, 2022
1d117dc
Parse inline type specification
JaroslavTulach Oct 11, 2022
a6b08f9
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 12, 2022
03b02c4
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 13, 2022
c20e0b5
Parsing qualified type signature
JaroslavTulach Oct 13, 2022
fd1ca6d
Support for nested blocks
JaroslavTulach Oct 13, 2022
f70ef15
Some support for types in case of
JaroslavTulach Oct 13, 2022
0679754
Unified translateMethodReference
JaroslavTulach Oct 13, 2022
6d68454
Properly represent method type
JaroslavTulach Oct 13, 2022
cdb0729
Merging with macros from develop branch
JaroslavTulach Oct 14, 2022
e7d4244
Support more compilicated case_of with types
JaroslavTulach Oct 14, 2022
7def987
Support for ... auto scope construct
JaroslavTulach Oct 14, 2022
967d370
Support [array type]
JaroslavTulach Oct 14, 2022
1804bbf
Operator Section Right
JaroslavTulach Oct 14, 2022
b6a731b
Use the new parser to build the IR
JaroslavTulach Oct 14, 2022
d3a65d5
Patch list body block
JaroslavTulach Oct 14, 2022
0d7e14a
Problems parsing lambda with a block
JaroslavTulach Oct 14, 2022
6ee5a82
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 15, 2022
02b801f
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 15, 2022
743dd33
Expect doc comments
JaroslavTulach Oct 17, 2022
9e67b53
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 17, 2022
dd53be4
_ : Filter fails right now
JaroslavTulach Oct 17, 2022
ee5f0d6
Documentation comment is represented in the IR
JaroslavTulach Oct 17, 2022
1e99d50
Parse By_Index, By_Column
JaroslavTulach Oct 17, 2022
77665ac
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 18, 2022
b77bfda
Parsing case_type_of with spaces works
JaroslavTulach Oct 18, 2022
65c6b92
Compose text literal from its sections
JaroslavTulach Oct 18, 2022
391431e
Parse escape sequences in text literals
JaroslavTulach Oct 18, 2022
eaf7815
Use default rather than case String x
JaroslavTulach Oct 18, 2022
7a29b92
Process Tree.Documented as well as its getExpression() inside of type…
JaroslavTulach Oct 18, 2022
0f59810
Removing the test - it is not a valid code in the old parser
JaroslavTulach Oct 18, 2022
2dfa0dc
Merging with develop branch
JaroslavTulach Oct 19, 2022
fa0de9e
Handle comments in the case branches
JaroslavTulach Oct 19, 2022
9fcd9bf
Parse the group type in the simple case
JaroslavTulach Oct 21, 2022
e64e40b
args.reverse() to get arguments in the right order
JaroslavTulach Oct 21, 2022
dc7b0b0
Support _ on LHS
JaroslavTulach Oct 21, 2022
57255f0
More robust handling of comments
JaroslavTulach Oct 21, 2022
c6e8177
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 21, 2022
2bb0663
Five more working tests
JaroslavTulach Oct 21, 2022
77b03e5
When RHS is null, construct some IR object
JaroslavTulach Oct 22, 2022
6fd3104
Allow one to directly specify file to parse and compare
JaroslavTulach Oct 22, 2022
d991372
Handle ~_ annomally
JaroslavTulach Oct 22, 2022
dc8cf47
Defining function with spaces or without spaces makes a difference
JaroslavTulach Oct 22, 2022
6290394
Merging 'origin/develop' back into wip/jtulach/UseRustParserFromJava_…
JaroslavTulach Oct 22, 2022
4448c2e
Properly convert groups of patterns in case of
JaroslavTulach Oct 22, 2022
452988c
Properly identify method. Even with spaces.
JaroslavTulach Oct 22, 2022
0f63cb5
Can parse Data/Any.enso and next three files properly
JaroslavTulach Oct 22, 2022
1bcf37a
Towards processing Network/Http.enso properly
JaroslavTulach Oct 22, 2022
9629f44
Failing test for Text.*
JaroslavTulach Oct 22, 2022
50c2120
Making Write_Flag parseable, just 71 to go
JaroslavTulach Oct 23, 2022
9e34c09
Detect has defaults suspended
JaroslavTulach Oct 23, 2022
8da3d55
Represent Vector.Vector properly
JaroslavTulach Oct 23, 2022
0fe6c90
Merge IR.Application.Prefix with IR.Name.Literal
JaroslavTulach Oct 23, 2022
b1959ec
Handle documentation comment in a block
JaroslavTulach Oct 23, 2022
e46b50d
Merge branch 'develop' into wip/jtulach/UseRustParserFromJava_182743471
JaroslavTulach Oct 23, 2022
f15d83e
Merge branch 'wip/jtulach/UseRustParserFromJava_182743471' of enso:en…
JaroslavTulach Oct 23, 2022
676bdb1
Few more passing tests
JaroslavTulach Oct 23, 2022
03884ed
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Oct 25, 2022
3c9d1c7
prevent merge conflict
kazcw Oct 26, 2022
5d59cd2
fix bug translating multi-argument function types
kazcw Oct 19, 2022
4c9d085
precedence of !=
kazcw Oct 19, 2022
fb2f2bf
improvements
kazcw Oct 19, 2022
f26d05b
dot operator precedence
kazcw Oct 19, 2022
f7def03
comma associativity
kazcw Oct 19, 2022
61a38dd
handle assignment in type bodies
kazcw Oct 19, 2022
17f8e5c
`default` is a legal argument name
kazcw Oct 19, 2022
a93edc1
constructors precede methods
kazcw Oct 19, 2022
4890203
translateCall
kazcw Oct 19, 2022
aad1fa4
compatibility with old parser quirk
kazcw Oct 20, 2022
36c2f8a
LoadParser
kazcw Oct 20, 2022
82d3c24
translate documentation in body blocks
kazcw Oct 20, 2022
df56b4a
translateType
kazcw Oct 20, 2022
9ab4cc7
fix translation of documented case branches
kazcw Oct 20, 2022
b32ddd8
support names in patterns
kazcw Oct 20, 2022
b758db2
fix unnecessarily-qualified names
kazcw Oct 20, 2022
6c642c3
fix translation of nested patterns
kazcw Oct 20, 2022
0bf77db
left-pipe is right-associative
kazcw Oct 20, 2022
4fcbbb7
Fix whitespace. Old parser handles this case weirdly.
kazcw Oct 20, 2022
c3da2fa
ignore top-level docs the old parser ignored
kazcw Oct 20, 2022
b210754
fix bug translating named args
kazcw Oct 20, 2022
486cd20
predence of !
kazcw Oct 20, 2022
8ad76cc
translate unary minus
kazcw Oct 20, 2022
e37ccbf
fix another bug translating named args
kazcw Oct 20, 2022
2df5841
fix translation of a function vs assignment case
kazcw Oct 20, 2022
877876b
match old parser behavior
kazcw Oct 20, 2022
129b9ac
fixup negate
kazcw Oct 20, 2022
9054ec9
translate non-decimal literals
kazcw Oct 20, 2022
5ba9d42
translate method-sections
kazcw Oct 20, 2022
084d3fd
precedence of && and ||
kazcw Oct 20, 2022
5d72908
translate operator sections
kazcw Oct 21, 2022
4a5fbb5
compatibility
kazcw Oct 21, 2022
e56e6e5
check the tests
kazcw Oct 21, 2022
33b1c9d
Try harder to remove all documentation comments from comparations
JaroslavTulach Oct 11, 2022
f194422
sync LoadParser
kazcw Oct 21, 2022
10ec691
fix ~_ argument handling
kazcw Oct 21, 2022
7a9182a
handle `Text.*` case
kazcw Oct 21, 2022
1d700ce
cleanup
kazcw Oct 21, 2022
1962a99
reject some bad import syntaxes
kazcw Oct 21, 2022
1a733e3
translate onlyNames/hiddenNames in import
kazcw Oct 21, 2022
50b5478
fix text-lexer bug
kazcw Oct 21, 2022
8f28860
drop documentation at the end of a block, for compatibility
kazcw Oct 21, 2022
a9200f7
implement `foreign` keyword
kazcw Oct 21, 2022
73faede
try to reproduce old parser's buggy doc-comment trim
kazcw Oct 22, 2022
fbd6543
fix syntax in tests
kazcw Oct 26, 2022
514d998
Parse (+)
JaroslavTulach Oct 26, 2022
5992b66
emulate AstToIr bug
kazcw Oct 26, 2022
bd2b6cc
translate groups in patterns
kazcw Oct 26, 2022
466ab24
Test is the right directory
JaroslavTulach Oct 26, 2022
590c016
update ParseStdLibTest
kazcw Oct 26, 2022
7d1603f
handle text newlines according to the observed behavior of the old pa…
kazcw Oct 26, 2022
d91b32b
old-style non-decimal numbers as discovered to be in current use
kazcw Oct 26, 2022
a8fb209
text edge case
kazcw Oct 26, 2022
93218a2
match another AstToIr quirk
kazcw Oct 26, 2022
3d904a1
fix precedence bug
kazcw Oct 26, 2022
674d6b3
translation: support currying of method sections
kazcw Oct 26, 2022
a6b5c10
translation: foreign functions can be TCO
kazcw Oct 26, 2022
56aaa2f
Merge with Kaz's overnight changes
JaroslavTulach Oct 27, 2022
37f2513
Reasonable Module.toString() helps debugging
JaroslavTulach Oct 27, 2022
34f49f2
Print out the value of isAll when dumping the IR. Make sure it is tru…
JaroslavTulach Oct 27, 2022
bdd2671
Two currently failing tests related to text literals
JaroslavTulach Oct 28, 2022
e1ed61a
Define check function rather than using lambda
JaroslavTulach Oct 30, 2022
7cd492e
Merging with develop branch to resolve conflict in ParseStdLibTest
JaroslavTulach Oct 30, 2022
93ff443
Apply cargo fmt
JaroslavTulach Oct 31, 2022
9c976d9
Merge remote-tracking branch 'origin/wip/kw/parser/parse-stdlib' into…
JaroslavTulach Oct 31, 2022
99e8a35
TypeSignaturesTest.testResolveExecutionContext is failing
JaroslavTulach Oct 31, 2022
e95c543
Eliminating NPEs when traversing the IR produced from Tree
JaroslavTulach Oct 31, 2022
e0f3dba
Locate the enso_parser library in native-libraries directory
JaroslavTulach Oct 31, 2022
bed9e09
Search for the enso_parser library in component folder
JaroslavTulach Oct 31, 2022
6d2f112
Iterate over root, not dir
JaroslavTulach Oct 31, 2022
420112b
Spaces at the end of file are treated as another argument
JaroslavTulach Oct 31, 2022
19d62ab
Support group lambda arguments
JaroslavTulach Oct 31, 2022
d76e74a
Always use the new parser
JaroslavTulach Oct 31, 2022
3af5197
Application of autoscope parameters
JaroslavTulach Oct 31, 2022
3f6545a
Implemented suspended argument in a grouping test
JaroslavTulach Oct 31, 2022
ef0d294
Merging with the magnificent work of Kaz in PR-3830
JaroslavTulach Oct 31, 2022
3ce7899
Properly formatting Scala sources
JaroslavTulach Oct 31, 2022
aa0557f
sbt javafmtAll
JaroslavTulach Nov 1, 2022
f397662
Body of () cannot be empty that's a syntax error
JaroslavTulach Nov 1, 2022
b772608
@ isn't an operator
JaroslavTulach Nov 1, 2022
c1d52a0
Additional scala formatting
JaroslavTulach Nov 1, 2022
a10187d
Make StrictCompileDiagnosticsTest pass
JaroslavTulach Nov 1, 2022
c7d7c38
Optionally don't mangle IDs, locations and comments
JaroslavTulach Nov 1, 2022
1eac92a
Adjusting locations the way CodeLocationsTest seems to expect them
JaroslavTulach Nov 2, 2022
691cc77
Provide more information about 'close misses', allow certain differen…
JaroslavTulach Nov 2, 2022
cfade84
Make sure last line in tests has stripMargin
JaroslavTulach Nov 2, 2022
03cdbd3
Negative literal group is now single LiteralNode
JaroslavTulach Nov 2, 2022
4e5a283
Few more CodeLocationsTests that pass
JaroslavTulach Nov 2, 2022
2777085
Another batch of end-of-file spaces stripping
JaroslavTulach Nov 2, 2022
afaf12c
Support sugared function definition
JaroslavTulach Nov 2, 2022
b2908b2
Tree.Function without getBody() problem
JaroslavTulach Nov 2, 2022
e6fbec5
Merging with develop branch that contains enso_parser library in engi…
JaroslavTulach Nov 2, 2022
ca71d9d
No need for these changes
JaroslavTulach Nov 3, 2022
b6f379f
Reformatting scala code
JaroslavTulach Nov 3, 2022
87ed938
Better location for method reference
JaroslavTulach Nov 3, 2022
eaf824c
New parser often represents end of line as a start of the next line
JaroslavTulach Nov 3, 2022
d8cb4b4
Metadata parsing works
JaroslavTulach Nov 3, 2022
3bb74e9
SuggestionsBuilderTest passes without errors
JaroslavTulach Nov 3, 2022
29ac63e
Restrict the instrumentation only on the Test source
JaroslavTulach Nov 4, 2022
bdab992
Dump locations of instrumented nodes in Test source
JaroslavTulach Nov 4, 2022
921b17b
Keep UUID when patching a location. Fixes ExpressionIdTest.
JaroslavTulach Nov 4, 2022
fd59b52
Easy way to switch between new and old parser by changing a single line
JaroslavTulach Nov 4, 2022
2a0c07c
Dump values for all nodes, not just tagged ones
JaroslavTulach Nov 4, 2022
582e113
Fixing another 'off by one' error
JaroslavTulach Nov 4, 2022
a4ea227
Preserving the ID when patching location fixes ExpressionIdTest
JaroslavTulach Nov 4, 2022
8804db2
Re-merged with origin/develop
JaroslavTulach Nov 4, 2022
4952e12
Make sure imported names have location
JaroslavTulach Nov 4, 2022
3042275
Replace by just _
JaroslavTulach Nov 4, 2022
3943e0d
Basic support for parsing in operator
JaroslavTulach Nov 4, 2022
ea010c1
Merging with origin/develop
JaroslavTulach Nov 7, 2022
9b7852a
Less differences against develop branch
JaroslavTulach Nov 7, 2022
a631b0b
Attaching external IDs to more import/export elements
JaroslavTulach Nov 7, 2022
694d301
test: annotate lambda body
4e6 Nov 7, 2022
2922b0f
Merge branch 'wip/jtulach/UseRustParserFromJava_182743471' of enso:en…
JaroslavTulach Nov 7, 2022
1ff561b
Avoid patching locations for blocks. Adjust the locations in the tests
JaroslavTulach Nov 7, 2022
7350b0d
test: fix suggestion updates
4e6 Nov 7, 2022
bc02106
Adjusting positions for the new parser
JaroslavTulach Nov 7, 2022
1aa5b40
Disabling the test. It is tracked as EnsoCompiler.testInThePresenceOf…
JaroslavTulach Nov 7, 2022
02b3506
Polishing before integration
JaroslavTulach Nov 7, 2022
cd0bba4
Disabling two Unicode whitespace tests for now
JaroslavTulach Nov 8, 2022
4112368
Making up-to-date with develop branch
JaroslavTulach Nov 8, 2022
91cafcc
Avoid NPE when running AtomBenchmarks
JaroslavTulach Nov 8, 2022
cc65c81
Adjusting the AtomBenchmarks to run
JaroslavTulach Nov 8, 2022
6f8029f
Better (but not perfect) handling on raw blocks of text
JaroslavTulach Nov 8, 2022
bbb72d0
Use ENSO_PARSER=scala environment variable to request the old parser …
JaroslavTulach Nov 8, 2022
e84696f
Parse Json from Http_Spec.enso properly
JaroslavTulach Nov 8, 2022
54857c1
Merge branch 'develop' into wip/jtulach/UseRustParserFromJava_182743471
JaroslavTulach Nov 9, 2022
8f33e0a
Fallback to old parser when the .so file of the new one cannot be loaded
JaroslavTulach Nov 9, 2022
c6db855
Merge remote-tracking branch 'origin/develop' into wip/jtulach/UseRus…
JaroslavTulach Nov 10, 2022
56f04d6
Syntax error for InvalidEscapeSequence
JaroslavTulach Nov 10, 2022
010c6aa
Don't scare devs with too verbose messages
JaroslavTulach Nov 11, 2022
c0a12a9
To avoid long starvation limit the test to 5s
JaroslavTulach Nov 11, 2022
c44ff59
Accept changes from PR-3868
JaroslavTulach Nov 12, 2022
7641db8
Eliminating differences between CRLF and LF positions by stripping of CR
JaroslavTulach Nov 12, 2022
7d8137b
More CRLF -> LF conversions
JaroslavTulach Nov 12, 2022
648dc63
Mitigating another set of CRLF vs. LF differences
JaroslavTulach Nov 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@
- [Explicit `self`][3569]
- [Added benchmarking tool for the language server][3578]
- [Support module imports using a qualified name][3608]
- [Using parser written in Rust.][3611]
- [Enable caching in visualisation functions][3618]
- [Update Scala compiler and libraries][3631]
- [Support importing module methods][3633]
Expand Down Expand Up @@ -460,6 +461,7 @@
[3538]: https://github.com/enso-org/enso/pull/3538
[3569]: https://github.com/enso-org/enso/pull/3569
[3578]: https://github.com/enso-org/enso/pull/3578
[3611]: https://github.com/enso-org/enso/pull/3611
[3618]: https://github.com/enso-org/enso/pull/3618
[3608]: https://github.com/enso-org/enso/pull/3608
[3608]: https://github.com/enso-org/enso/pull/3608
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ class RuntimeServerTest
val contextId = UUID.randomUUID()
val requestId = UUID.randomUUID()
val moduleName = "Enso_Test.Test.Main"
val idMain = context.Main.metadata.addItem(54, 47, "aaaaa")
val idMain = context.Main.metadata.addItem(54, 46, "aaaaa")
val contents = context.Main.code
val mainFile = context.writeMain(contents)

Expand Down Expand Up @@ -1442,7 +1442,7 @@ class RuntimeServerTest
val moduleName = "Enso_Test.Test.Main"

val metadata = new Metadata
val idMain = metadata.addItem(77, 35, "aaaa")
val idMain = metadata.addItem(77, 34, "aaaa")
val idMainA = metadata.addItem(86, 8, "aabb")
val idMainP = metadata.addItem(99, 12, "aacc")
// pie id
Expand Down Expand Up @@ -1726,7 +1726,7 @@ class RuntimeServerTest
val moduleName = "Enso_Test.Test.Main"

val metadata = new Metadata
val idMain = metadata.addItem(122, 88, "aaaa")
val idMain = metadata.addItem(122, 87, "aaaa")
val id1 = metadata.addItem(131, 15, "aad1")
val id2 = metadata.addItem(151, 18, "aad2")
val id3 = metadata.addItem(174, 15, "aad3")
Expand Down Expand Up @@ -2147,7 +2147,7 @@ class RuntimeServerTest
val contextId = UUID.randomUUID()
val requestId = UUID.randomUUID()
val moduleName = "Enso_Test.Test.Main"
val idMain = context.Main.metadata.addItem(54, 47, "aaaa")
val idMain = context.Main.metadata.addItem(54, 46, "aaaa")

val mainFile = context.writeMain(context.Main.code)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ class RuntimeSuggestionUpdatesTest
ConstantsGen.ANY,
Suggestion.Scope(
Suggestion.Position(4, 6),
Suggestion.Position(9, 0)
Suggestion.Position(8, 11)
)
),
Api.SuggestionAction.Add()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AtomFixtures extends DefaultInterpreterRunner {
val reverseListCode =
"""from Standard.Base.Data.List import all
|
|main = list ->
|main = self -> list ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a TODO to figure out why self parameter is needed?

| reverser = acc -> list -> case list of
| Cons h t -> @Tail_Call reverser (Cons h acc) t
| Nil -> acc
Expand All @@ -56,7 +56,7 @@ class AtomFixtures extends DefaultInterpreterRunner {
| Cons h t -> @Tail_Call t.rev (Cons h acc)
| _ -> acc
|
|main = list ->
|main = self -> list ->
| res = list.rev Nil
| res
|""".stripMargin
Expand All @@ -65,7 +65,7 @@ class AtomFixtures extends DefaultInterpreterRunner {
val sumListCode =
"""from Standard.Base.Data.List import all
|
|main = list ->
|main = self -> list ->
| summator = acc -> list -> case list of
| Cons h t -> @Tail_Call summator acc+h t
| Nil -> acc
Expand All @@ -78,7 +78,7 @@ class AtomFixtures extends DefaultInterpreterRunner {
val sumListLeftFoldCode =
"""from Standard.Base.Data.List import all
|
|main = list ->
|main = self -> list ->
| fold = f -> acc -> list -> case list of
| Cons h t -> @Tail_Call fold f (f acc h) t
| _ -> acc
Expand All @@ -91,7 +91,7 @@ class AtomFixtures extends DefaultInterpreterRunner {
val sumListFallbackCode =
"""from Standard.Base.Data.List import all
|
|main = list ->
|main = self -> list ->
| summator = acc -> list -> case list of
| Cons h t -> @Tail_Call summator acc+h t
| _ -> acc
Expand All @@ -108,7 +108,7 @@ class AtomFixtures extends DefaultInterpreterRunner {
| Cons h t -> @Tail_Call t.sum h+acc
| _ -> acc
|
|main = list ->
|main = self -> list ->
| res = list.sum 0
| res
|""".stripMargin
Expand All @@ -121,7 +121,7 @@ class AtomFixtures extends DefaultInterpreterRunner {
| Cons h t -> @Tail_Call t.mapReverse f (Cons (f h) acc)
| _ -> acc
|
|main = list ->
|main = self -> list ->
| res = list.mapReverse (x -> x + 1) Nil
| res
|""".stripMargin
Expand All @@ -134,7 +134,7 @@ class AtomFixtures extends DefaultInterpreterRunner {
| Cons h t -> @Tail_Call t.mapReverse f (Cons (f h) acc)
| _ -> acc
|
|main = list ->
|main = self -> list ->
| adder = x -> y -> x + y
| res = list.mapReverse (adder 1) Nil
| res
Expand Down
33 changes: 24 additions & 9 deletions engine/runtime/src/main/java/org/enso/compiler/TreeToIr.java
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ yield switch (op.codeRepr()) {
expressions.remove(expressions.size()-1);
}
var list = CollectionConverters.asScala(expressions.iterator()).toList();
var locationWithANewLine = getIdentifiedLocation(body, 0, 1, null);
var locationWithANewLine = getIdentifiedLocation(body, 0, 0, null);
if (last != null && last.location().isDefined() && last.location().get().end() != locationWithANewLine.get().end()) {
var patched = new Location(last.location().get().start(), locationWithANewLine.get().end() - 1);
var id = new IdentifiedLocation(patched, last.location().get().id());
Expand Down Expand Up @@ -713,11 +713,10 @@ yield switch (op.codeRepr()) {
List<IR.CallArgument> args = nil();
for (var line : body.getArguments()) {
var expr = line.getExpression();
if (expr != null) {
continue;
if (expr instanceof Tree.Ident) {
var call = translateCallArgument(expr);
args = cons(call, args);
}
var call = translateCallArgument(expr);
args = cons(call, args);
}
yield switch (fn) {
case IR$Application$Prefix pref -> patchPrefixWithBlock(pref, block, args);
Expand Down Expand Up @@ -958,18 +957,34 @@ IR.Literal translateLiteral(Tree.TextLiteral txt) {
return new IR$Literal$Text(value, getIdentifiedLocation(txt), meta(), diag());
}
String buildTextConstant(Iterable elements, boolean stripComments) {
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
for (var t : elements) {
switch (t) {
case TextElement.Section s -> {
var text = s.getText().codeRepr();
if (stripComments) {
// Reproduce an AstToIr bug for testing.
text = text.replaceAll("#[^\n\r]*", "");
var quotedSegments = text.split("\"", -1);
for (int i = 0; i < quotedSegments.length; i++) {
var seg = quotedSegments[i];
if (i % 2 == 0) {
sb.append(seg.replaceAll("#[^\n\r]*", ""));
} else {
sb.append('"');
sb.append(seg);
if (i + 1 < quotedSegments.length) {
sb.append('"');
}
}
}
} else {
sb.append(text);
}
sb.append(text);
}
case TextElement.Escape e -> sb.appendCodePoint(e.getToken().getValue());
case TextElement.Escape e -> {
var val = e.getToken().getValue();
sb.appendCodePoint(val);
}
default -> throw new UnhandledEntity(t, "buildTextConstant");
}
}
Expand Down
10 changes: 6 additions & 4 deletions engine/runtime/src/main/scala/org/enso/compiler/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -441,17 +441,19 @@ class Compiler(

val src = module.getSource
def oldParser() = {
System.err.println("Using old parser to process " + src.getURI())
val tree = parse(src)
generateIR(tree)
}
def newParser() = {
System.err.println("Using new parser to process " + src.getURI())
val tree = ensoCompiler.parse(src)
ensoCompiler.generateIR(tree)
}
val size = src.getCharacters().length()
// change the condition to use old or new parser
val expr = if (size >= 0) oldParser() else newParser()
val expr = if ("scala".equals(System.getenv("ENSO_PARSER"))) {
oldParser()
} else {
newParser()
}

val exprWithModuleExports =
if (module.isSynthetic)
Expand Down
Loading