Comments (4)
Haha, this is another case where I took shortcuts because of unreal limitations actually.
Unreal doesn't allow directly nested containers at all, so you can never actually get templates deeper than >>
in UE-AS scripts, and it's never allowed to cast to a container so we don't have the cast parsing issue.
You can see I also cheated some of the parsing ambiguity by hardcoding the available container types, since at least in our plugin there's a pretty small number of allowable containers that unreal understands.
The bug with parsing 2 >> 1
is concerning though. (Although I can probably count the amount of times we've actually used bit shifts in our game scripts on one hand haha)
I definitely will take a look at your solution, thank you for sharing it!
Although changing the operator parsing is a bit scary. In the past it has been by far the most combinatorially complex part of the rules and makes it really easy to wreck the parsing performance.
from vscode-unreal-angelscript.
You can see I also cheated some of the parsing ambiguity by hardcoding the available container types, since at least in our plugin there's a pretty small number of allowable containers that unreal understands.
Yeah, I piggybacked on that b/c it's a similar situation with openplanet's flavor. Users can't create new template types, so there's only half a dozen or so to account for.
(Although I can probably count the amount of times we've actually used bit shifts in our game scripts on one hand haha)
Yeah, I figured it wasn't that big a deal since it's a pretty uncommon operation and it doesn't break anything besides the LS type resolution afaik (which has very little impact).
Although changing the operator parsing is a bit scary. In the past it has been by far the most combinatorially complex part of the rules and makes it really easy to wreck the parsing performance.
Good to know it's a bottleneck for parsing performance. I didn't run into that with my testing last night, but I'll keep it in mind.
That reminds me of a pegged 100% CPU bug with my fork (not sure exactly what was looping infinitely but something was) -- after some profiling and a binary search of what code was responsible, this was the solution: (I think the @
at the end was the main thing, just noticed that I added :
in there, too)
So yeah, potentially big impacts from small changes.
An alternate solution I thought of was reprocessing the AST output to detect the case of BinaryOp<BinaryOp<left,null>,right>
(where .operator == ">"
for both) and replacing it with the corrected expression. If you are interested in fixing the type resolution without touching the parser, that might be a less risky method (although a bit hack-y).
from vscode-unreal-angelscript.
I tested it out over here, and it looks like 2 >> 1
is being correctly detected as int
for me.
Most likely because the lexer is disambiguating it by parsing >>
as one token, which I think you've removed in your fork.
Since the template and cast parsing issues are not possible to trigger for us due to unreal limitations, I'm going to close this issue.
But thank you for taking the time to report it and providing your analysis!
from vscode-unreal-angelscript.
Most likely because the lexer is disambiguating it by parsing
>>
as one token, which I think you've removed in your fork.
I have now - but that's pretty recent. I don't know if it was being incorrectly detected before I started fiddling with >>
yesterday.
I changed some things earlier when I was trying to get template types working (like a week or more ago), so I might have broken the type detection then without knowing, too (since opShr is pretty rare).
In any case, glad to hear it's not an issue.
I'm going to close this issue.
👍 sounds good.
from vscode-unreal-angelscript.
Related Issues (10)
- Separate the language server HOT 3
- Show signature of event/delegate on hover
- Crashing when hot reloading bad switch case
- Adding "Find All References" functionality HOT 3
- file decorations on parse errors and squiggles HOT 1
- Malformed scope from curly braces in comments breaks autocomplete
- Member variables with space breaks auto-complete
- Handle types support HOT 1
- Can't get the extension to work in vscode extension debugger HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-unreal-angelscript.