parsers
parsers copied to clipboard
Dart 2.0 Support
Hi @polux, All test are passing.
I know these are a lot of changes to review, so I suggest going commit by commit. I've tried to keep them smaller and stick to what the message says.
I've raised the sdk constraints to >=2.0.0 Not sure if anyone needs it to be lower than that. Also didn't have time to test it against Dart 1. ~But it should work!~ I removed new and const operators, so it won't
I fixed 1 example too full_arith.
Closes #23
Thanks for this great contribution! I'm wondering: which version of dart are you using? With v2.3.0.dev.0.1 I'm getting an error when running the full_arith example (which I understand you have fixed):
Unhandled exception:
type '() => dynamic' is not a subtype of type '() => Parser<dynamic>'
#0 Arith.expr (file:///tmp/parsers/example/full_arith.dart:29:17)
#1 Arith.start (file:///tmp/parsers/example/full_arith.dart:20:16)
#2 main (file:///tmp/parsers/example/full_arith.dart:42:17)
#3 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:19)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)
@polux I'm using Dart stable 2.2.0
Looks like 2.3+ adds more type checks. 🤦♂️ Should've tested against it. Will probably release soon.
The good news is the tests pass on 2.3. Would you mind fixing the full_arith example before I merge?
Also I'm getting errors when running test/run.sh. It looks like dartanalyzer doesn't see package:parsers/parsers.dart and package:test/test.dart when analyzing test/parsers_test.dart. I suppose something has changed in the behavior of dartanalyzer and the way it resolves files. Would you happen to know anything about that?
I don't know how to fix it without running Dart 2.3+ and it isn't easy to switch versions on windows. From the stacktrace, It's definitely not a parsers lib issue. I added more types and replaced the operators with method equivalents. That should make it work for you.
About the analyzer. I ran it locally for individual files. And on directories too. it worked fine. Except for a deprecation warning on a test. The analyzer will ignore any files present in the exclude key of analysis_options.yaml Do you have anything added to it locally.
Hey @polux, @devkabiir what's the state of this?
It's been a while since I last worked on it, If @polux is available for review, I can give it another run.
Hi, by all means, please give it another run. I'll do my best to spend some time reviewing it.