Lime samples won't compile - haxe

I can't build lime samples. What am I missing? What's going on?
This is what I've been doing for the last few days:
Download and install latest version of haxe
haxelib install lime
haxelib run lime setup
haxelib run lime create SimpleImage C:/ex
haxelib run lime test C:/ex flash
And I get this:
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:60: characters 3-16 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:61: characters 3-17 : haxe.io.Bytes has no field setUInt16
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:62: characters 3-17 : haxe.io.Bytes has no field setUInt16
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:63: characters 3-16 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:67: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:68: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:69: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:70: characters 2-16 : haxe.io.Bytes has no field setUInt16
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:71: characters 2-16 : haxe.io.Bytes has no field setUInt16
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:72: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:73: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:74: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:75: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:76: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:77: characters 2-15 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:81: characters 3-16 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:82: characters 3-16 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:83: characters 3-16 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/format/BMP.hx:84: characters 3-16 : haxe.io.Bytes has no field setInt32
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/utils/ImageDataUtil.hx:1088: characters 14-24 : Unknown identifier : NOT_EQUALS
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/utils/ImageDataUtil.hx:1089: characters 14-20 : Unknown identifier : EQUALS
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/utils/ImageDataUtil.hx:1090: characters 14-23 : Unknown identifier : LESS_THAN
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/utils/ImageDataUtil.hx:1091: characters 14-35 : Unknown identifier : LESS_THAN_OR_EQUAL_TO
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/utils/ImageDataUtil.hx:1092: characters 14-26 : Unknown identifier : GREATER_THAN
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/utils/ImageDataUtil.hx:1093: characters 14-38 : Unknown identifier : GREATER_THAN_OR_EQUAL_TO
C:/HaxeToolkit/haxe/lib/lime/2,9,0/lime/graphics/utils/ImageDataUtil.hx:1137: characters 11-21 : Capture variables must be lower-case
I get all kind of errors when I try to compile other projects. All those errors are as weird as these, as if haxe didn't know it's own classes.
Thank you very much for your time!
PS: haxelib list:
hxcpp: [3.2.205]
lime-samples: [2.6.0]
lime: [2.9.0]

as #larsiusprime guessed in comment to question, it looks like wrong haxe version
yours haxe version is 3.1.3
meanwhile latest haxe version 3.2.1
try to update haxe toolkit

Related

ANTLRv4 - How to identify unquoted quote within string

How would I recognise the string "Aren't you a string?" without getting a token recognition error at the apostrophe?
Here is the relative grammar from my lexer:
STRING_LITERAL : '"' STRING? '"';
fragment STRING : STRING_CHARACTER+;
fragment STRING_CHARACTER : ~["'\\] | ESCSEQ;
fragment ESCSEQ : '\\' [tnfr"'\\];
Remove the single quote from ~["'\\]:
STRING_LITERAL : '"' STRING? '"';
fragment STRING : STRING_CHARACTER+;
fragment STRING_CHARACTER : ~["\\] | ESCSEQ;
fragment ESCSEQ : '\\' [tnfr"'\\];

Lexer and Parser rules for a simple command processor

I am attempting to build a simple command processor for a legacy language.
I am attempting to work with C# with antlr4 version "ANTLR", "4.6.6")
I am unable to make progress against one scenario, of several.
The following examples shows various sample invocations of the command PKS.
PKS
PKS?
PKStext_that_is_a_filename
The scenario that I can not solve is the PKS command followed by filename.
Command:
PKS
(block (line (expr (command PKS)) (eol \r\n)) <EOF>)
Command:
PKS?
(block (line (expr (command PKS) (query ?)) (eol \r\n)) <EOF>)
Command:
PKSFILENAME
line 1:0 mismatched input 'PKSFILENAME' expecting COMMAND
(block PKSFILENAME \r\n)
Command:
what I believe to be the relevant snippet of grammar:
block : line+ EOF;
line : (expr eol)+;
expr : command file
| command listOfDouble
| command query
| command
;
command : COMMAND
;
query : QUERY;
file : TEXT ;
eol : EOL;
listOfDouble: DOUBLE (COMMA DOUBLE)* ;
From the lexer:
COMMAND : PKS;
PKS :'PKS' ;
QUERY : '?'
;
fragment LETTER : [A-Z];
fragment DIGIT : [0-9];
fragment UNDER : [_];
TEXT : (LETTER) (LETTER|DIGIT|UNDER)* ;
The main problem here is that your TEXT rule also matches what PKS is supposed to match. And since PKStext_that_is_a_filename can entirely be matched by that TEXT rule it is preferred over the PKS rule, even though it appears first in the grammar (if 2 rules match the same input then the first one wins).
In order to fix that problem you have 2 options:
Require whitespace(s) between the keyword (PKS) and the rest of the expression.
Change the TEXT rule to explicitly exclude "PKS" as valid input.
Option 2 is certainly possible, but will get very messy if you have have more keywords (as they all would have to be excluded). With a whitespace between the keywords and the text the lexer would automatically do that for you.
And let me give you a hint to approach such kind of problems: always check the token list produced by the lexer to see if it generated the tokens you expected. I reworked your grammar a bit, added missing tokens and ran it through my ANTLR4 debugger, which gave me:
Parser error (5, 1): extraneous input 'PKStext_that_is_a_filename' expecting {<EOF>, COMMAND, EOL}
Tokens:
[#0,0:2='PKS',<1>,1:0]
[#1,3:3='\n',<8>,1:3]
[#2,4:4='\n',<8>,2:0]
[#3,5:7='PKS',<1>,3:0]
[#4,8:8='?',<3>,3:3]
[#5,9:9='\n',<8>,3:4]
[#6,10:10='\n',<8>,4:0]
[#7,11:36='PKStext_that_is_a_filename',<7>,5:0]
[#8,37:37='\n',<8>,5:26]
[#9,38:37='<EOF>',<-1>,6:0]
For this input:
PKS
PKS?
PKStext_that_is_a_filename
Here's the grammar I used:
grammar Example;
start: block;
block: line+ EOF;
line: expr? eol;
expr: command (file | listOfDouble | query)?;
command: COMMAND;
query: QUERY;
file: TEXT;
eol: EOL;
listOfDouble: DOUBLE (COMMA DOUBLE)*;
COMMAND: PKS;
PKS: 'PKS';
QUERY: '?';
fragment LETTER: [a-zA-Z];
fragment DIGIT: [0-9];
fragment UNDER: [_];
COMMA: ',';
DOUBLE: DIGIT+ (DOT DIGIT*)?;
DOT: '.';
TEXT: LETTER (LETTER | DIGIT | UNDER)*;
EOL: [\n\r];
and the generated visual parse tree:

Notepad++ remove text between string+bracket and another bracket

So, I've seen that you can remove between two characters and remove between two strings but I haven't been able to find a system that works between a string and a character.
I need to remove the numbers between the two brackets in...
provinces= {
923 6862 9794 9904 11751 11846 11882
}
Keep in mind that these files also contains other brackets which are needed. I've looked around for a solution for this but none seem to work :/
Thanks for the help.
This one will do the job:
Ctrl+H
Find what: \b(provinces\s*=\s*\{)[^}]+(\})
Replace with: $1$2
Replace all
Explanation:
\b : a word boundary
( : start group 1
provinces : literally "provinces"
\s* : 0 or more spaces
= : equal sign
\s* : 0 or more spaces
\{ : an open curly bracket, must be escaped because it has special meaning in regex
) : end group 1
[^}]+ : any character that is not a close curly bracket
(\}) : group 2, a close curly bracket, escaped.
Replacement:
$1$2 : group 1 then group 2

How to disambiguate text with ANTLR4 that is sometimes two tokens, and sometime a third one?

I have a problem with ANTLR4 grammar. I need to parse a text that contains 6 AN characters.
Based on the context of the text, it can represent:
- a 6-AN identifier (flight reservation number - PNR - which looks like 7B22MS, or JPN92Y, or similar),
- airline designator (two letters) + flight number (four number), e.g. LH1856.
The problem is that if I create lexer rules that parse airline, number and PNR identifier like this:
Airline : 'A'..'Z''A'..'Z';
FlNum : ('0'..'9')('0'..'9')('0'..'9')('0'..'9');
PNR : ('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9');
then the PNR rule always wins and eats all the tokens that match its pattern.
How can I change this so that the Airline and FlNum will be parsed, if the context of the grammar needs them?
How about this:
AirlineAndFlNm : 'A'..'Z' 'A'..'Z' ('0'..'9')('0'..'9')('0'..'9')('0'..'9');
PNR : ('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9')('A'..'Z'|'0'..'9');
or more readable:
AirlineAndFlNm : LETTER LETTER DIGIT DIGIT DIGIT DIGIT ;
PNR : AlphaNum AlphaNum AlphaNum AlphaNum AlphaNum AlphaNum;
// fragments can only be used by other rules, will never create a token on their own
fragment LETTER: 'A'..'Z';
fragment DIGIT : '0'..'9';
fragment AlphaNum: LETTER | DIGIT ;
It should be easy to separate AirlineAndFlNm afterwards.
And since AirlineAndFlNm is placed before PNR, it will match if it can.
Let the lexer tokenize single characters and promote these rules to parser rules:
// parser rules
airline
: LETTER
;
fl_num
: DIGIT DIGIT DIGIT DIGIT
;
pnr
: alpha_num alpha_num alpha_num alpha_num alpha_num alpha_num
;
alpha_num
: DIGIT
| LETTER
;
// lexer rules
DIGIT
: [0-9]
;
LETTER
: [A-Z]
;

how to use true value of a character in vimwiki ?

I typed these content in vimwiki :
here $1 is matched for[[name]]
and then I convert wiki to HTML :
here \)1 is matched for name
The question is how to get true value of specail character ,such as $, [[ ?
in Regexp , I can use backslash to use tre value of a character :
here \$1 ....
But in vimwiki , how can I do it ?

Resources