Dart number_format.dart suddenly won't compile - dart

I made a small change in my server code not related to formatting numbers and now the dart library number_format.dart won't compile giving me 12 errors and two warnings. number_format is in intl as noted in the comments and the first error is at line 106. Some or most of the other errors appear to cascade from a first error.
Does anyone know how I may resolve this? I presume I need to edit something in my yaml file.
EDIT
If I choose Tools-> Pub Upgrade then I get the pre-build Problems below This weekend I could choose Tools->Pub Build - Debug but at the moment this does not work. Deleting .pub and following Günter Zöchbauer's suggestion allowed me to do a build Sunday - I hope is still does.
Pre-build Problems output:
Errors:
Line 106: Expected an identifier
Line 106: Expected to find ':'
Line 106: Unexpected token '?'
Line 131: Unexpected token '?'
Line 132: Expected an identifier
Line 132: Expected to find ':'
Line 233: Expected an identifier
Line 233: Expected to find ':'
Line 233: Unexpected token '?'
Line 545: Expected an identifier
Line 545: Expected to find ':'
Line 545: Unexpected token '?'
Warnings:
Line 106: Conditions must have a static type of 'bool'
Line 545: Conditions must have a static type of 'bool'
Hint:
Line 425: When compiled to JS, this test might return true when the left hand side is an int
Thanks

Related

Garry's Mod Lua: Errors that request symbols that shouldn't be there?

I've been attempting to make a GMod gamemode, and as usual, lua is being annoying. It's requesting symbols that (as far as I know) shouldn't be there.
The errors:
gamemodes/gmdm/gamemode/init.lua:7: '(' expected near 'player_manager'
Code in question
function GM:PlayerSpawn
player_manager:SetPlayerClass( ply, "player_custom" )
Error:
gamemodes/gmdm/gamemode/player_class/player_custom.lua:4: '=' expected near 'player_manager'
1. unknown - gamemodes/gmdm/gamemode/player_class/player_default.lua:4
2. include - [C]:-1
3. unknown - gamemodes/gmdm/gamemode/shared.lua:1
4. include - [C]:-1
5. unknown - gamemodes/gmdm/gamemode/cl_init.lua:1
Code:
player_manager:SetPlayerClass( ply, "player_custom", )
(the other file lines it's referring to are the line include ("player_custom.lua") as well as shared.lua in cl_init.lua for some reason?)
Error:
gamemodes/gmdm/gamemode/shared.lua:10: attempt to call field 'Class' (a nil value)
1. unknown - gamemodes/gmdm/gamemode/shared.lua:10
Code:
player.Class( "player_default" )
player.Class( "player_custom" )
(it complains regardless of if it's Class or CLASS)
I have tried adding the symbols requested around the code but then it complains an unexpected symbol (presumably the ) ) is near the :
This one kind of confused me, as far as I know there's no reason there should be an = there.
As I said, I changed the capitalization, which didn't help.
I've been following the code from https://wiki.facepunch.com/gmod/Player_Classes as guide if using it as reference helps debug
Thank you very much for your time.

F# FSI "Unexpected compiler generated literal in interaction" with "#I __SOURCE_DIRECTORY__"

If I create a new F# file 'Test.fsx' in VSCode with the line
#I __SOURCE_DIRECTORY__
attempting to run the code in FSI generates the error
Test.fsx(2,4): error FS0010: Unexpected compiler generated literal in interaction. Expected incomplete structured construct at or before this point, ';', ';;' or other token.
Any idea what might be going wrong?
It is a known issue in VS2019, which has been fixed in VS2022.
https://github.com/dotnet/fsharp/issues/13467
You may replace the code with
#I "."

Determining ANTLR version to use, or converting between?

I want to take the .g files from Apache Hive and build a parser (targeting JavaScript) -- initially, as just a way to validate user-input Hive queries. The files I'm using come from apache-hive-1.0.0-src\ql\src\java\org\apache\hadoop\hive\ql\parse from the Hive tgz: HiveLexer.g, HiveParser.g, FromClauseParser.g, IdentifiersParser.g, SelectClauseParser.g.
I see no indication within the grammar files which version of ANTLR to use, so I've tried running antlr (from apt-get pccts), antlr3 and antlr4. they all throw errors of some sort, so I have no clue which one to run or if I can (or need to) convert the .g files between versions.
The errors I'm getting are as follows:
antlr -Dlanguage=JavaScript HiveParser.g (looks like it doesn't support JS anyway):
warning: invalid option: '-Dlanguage=JavaScript'
HiveParser.g, line 17: syntax error at "grammar" missing { QuotedTerm PassAction ! \< \> : }
HiveParser.g, line 17: syntax error at "HiveParser" missing { QuotedTerm PassAction ! \< \> : }
HiveParser.g, line 17: syntax error at ";" missing Eof
HiveParser.g, line 28: lexical error: invalid token (text was ',')
antlr3 -Dlanguage=JavaScript HiveParser.g:
error(10): internal error: Exception FromClauseParser.g:302:85: unexpected char: '-'#org.antlr.grammar.v2.ANTLRLexer.nextToken(ANTLRLexer.java:347): unexpected stream error from parsing FromClauseParser.g
error(150): grammar file FromClauseParser.g has no rules
error(100): FromClauseParser.g:0:0: syntax error: assign.types: <AST>:299:68: unexpected AST node: ->
error(100): FromClauseParser.g:0:0: syntax error: define: <AST>:299:68: unexpected AST node: ->
error(106): SelectClauseParser.g:151:18: reference to undefined rule: tableAllColumns
antlr4 -Dlanguage=JavaScript HiveParser.g:
warning(202): HiveParser.g:30:0: tokens {A; B;} syntax is now tokens {A, B} in ANTLR 4
error(50): HiveParser.g:636:34: syntax error: '->' came as a complete surprise to me while looking for rule element
error(50): HiveParser.g:636:37: syntax error: '^' came as a complete surprise to me
error(50): HiveParser.g:638:50: syntax error: '->' came as a complete surprise to me while looking for rule element
error(50): HiveParser.g:638:53: syntax error: '^' came as a complete surprise to me
The antlr3 error referencing #org.antlr.grammar.v2.ANTLRLexer.nextToken seems suspect. Is it using the v2 lexer instead of v3? If so, maybe v3 is what I should target, but it's somehow not hitting it?
Or is this not an issue with versioning and instead with invocation? Or is Hive built in a way that provides additional files needed?
According to Hive source code, they use ANTLR 3.4. But before you start remove the last string from FromClauseParser.g
//------------------------------------------------------------------------

Lua Compiling Error 'do' expected near '['

I have a Lua file that I decompiled using unluac. When I try to recompile the files without any changes I get the following error:
lua: main.lua:647: 'do' expected near '['
I really do not know the problem here, as the while do statement follows the correct format.
The error is on line 647 as stated above.
Source is here:
Full Pastebin Source
Expressions like while {}[1] do and if {}[1].parentFolderName then are invalid because of {}[1] reference. It needs to be ({})[1]. It's probably a result of some sort of automated processing, but you should be able to fix it manually.

DParser: Unresolved Ambiguity

I have a large grammar written for DParser format and using the Python binding. When I parse a code using this grammar, I get the following exception but with different symbols depending on what code I pass to it. But the ambiguous symbols are always the same non_terminal. How do I find out what the ambiguity is?
Traceback (most recent call last):
File "parser.py", line 2030, in ambiguity
raise dparser.AmbiguityException("\n\nUnresolved ambiguity! Symbols:\n " + '\n'.join([node.symbol for node in nodes]))
dparser.AmbiguityException:
Unresolved ambiguity! Symbols:
non_terminal
non_terminal
Any hints or ideas would be appreciated.

Resources