Skip to content

Commit

Permalink
added bin_digits
Browse files Browse the repository at this point in the history
cleanup <4.3.0 conditionals (now requires Haxe 4.3.x or better to compile)
  • Loading branch information
AlexHaxe committed Apr 18, 2024
1 parent aaba928 commit a5fce2e
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/haxeparser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
haxe-version: ['4.3.1', 'nightly']
haxe-version: ['4.3.4', 'nightly']
steps:
- name: Checkout sources
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .haxerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "bdd7bf4",
"version": "569e52e",
"resolveLibs": "scoped"
}
8 changes: 5 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"test-adapter"
],
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.sortImports": false
"source.organizeImports": "never",
"source.sortImports": "never"
},
"haxe.enableExtendedIndentation": true
"haxe.enableExtendedIndentation": true,
"haxe.enableCompilationServer": false,
"editor.inlayHints.enabled": "off"
}
6 changes: 3 additions & 3 deletions haxe_libraries/hxparse.hxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @install: lix --silent download "gh://github.com/simn/hxparse#32e376f80c4b0e999e9f3229947d4dac2138382b" into hxparse/4.0.1/github/32e376f80c4b0e999e9f3229947d4dac2138382b
-cp ${HAXE_LIBCACHE}/hxparse/4.0.1/github/32e376f80c4b0e999e9f3229947d4dac2138382b/src
-D hxparse=4.0.1
# @install: lix --silent download "gh://github.com/simn/hxparse#876070ec62a4869de60081f87763e23457a3bda8" into hxparse/4.3.0/github/876070ec62a4869de60081f87763e23457a3bda8
-cp ${HAXE_LIBCACHE}/hxparse/4.3.0/github/876070ec62a4869de60081f87763e23457a3bda8/src
-D hxparse=4.3.0
6 changes: 3 additions & 3 deletions haxe_libraries/test-adapter.hxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# @install: lix --silent download "haxelib:/test-adapter#2.0.5" into test-adapter/2.0.5/haxelib
# @install: lix --silent download "haxelib:/test-adapter#2.0.7" into test-adapter/2.0.7/haxelib
-lib json2object
-cp ${HAXE_LIBCACHE}/test-adapter/2.0.5/haxelib/
-D test-adapter=2.0.5
-cp ${HAXE_LIBCACHE}/test-adapter/2.0.7/haxelib/
-D test-adapter=2.0.7
--macro _testadapter.Macro.init()
7 changes: 3 additions & 4 deletions haxe_libraries/utest.hxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# @install: lix --silent download "gh://github.com/haxe-utest/utest#5de48a964ca75c8e6321ac9706346a24958af2a4" into utest/1.13.2/github/5de48a964ca75c8e6321ac9706346a24958af2a4
-cp ${HAXE_LIBCACHE}/utest/1.13.2/github/5de48a964ca75c8e6321ac9706346a24958af2a4/src
-D utest=1.13.2
--macro utest.utils.Macro.checkHaxe()
# @install: lix --silent download "gh://github.com/haxe-utest/utest#bdb5fec4b8e77d9a3c079d9cfb108f29f153721a" into utest/2.0.0-alpha/github/bdb5fec4b8e77d9a3c079d9cfb108f29f153721a
-cp ${HAXE_LIBCACHE}/utest/2.0.0-alpha/github/bdb5fec4b8e77d9a3c079d9cfb108f29f153721a/src
-D utest=2.0.0-alpha
--macro utest.utils.Macro.importEnvSettings()
7 changes: 6 additions & 1 deletion src/haxeparser/Data.hx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ typedef Definition<A,B> = {
enum TypeDef {
EClass(d:Definition<ClassFlag, Array<Field>>);
EEnum(d:Definition<EnumFlag, Array<EnumConstructor>>);
ETypedef(d:Definition<EnumFlag, ComplexType>);
ETypedef(d:Definition<TypedefFlag, ComplexType>);
EAbstract(a:Definition<haxeparser.AbstractFlag, Array<Field>>);
EStatic(s:Definition<StaticFlag, FieldType>);
EImport(sl:Array<{pack:String, pos:Position}>, mode:ImportMode);
Expand Down Expand Up @@ -277,6 +277,11 @@ enum EnumFlag {
EExtern;
}

enum TypedefFlag {
TDPrivate;
TDExtern;
}

enum StaticFlag {
SDynamic;
SFinal;
Expand Down
2 changes: 1 addition & 1 deletion src/haxeparser/DefinitionConverter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DefinitionConverter {
return def;
}

static function convertTypedef(t:Definition<EnumFlag, ComplexType>) {
static function convertTypedef(t:Definition<TypedefFlag, ComplexType>) {
var def = getGeneralDefinition(t);
def.kind = TDAlias(t.data);
return def;
Expand Down
6 changes: 2 additions & 4 deletions src/haxeparser/HaxeLexer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class HaxeLexer extends Lexer implements hxparse.RuleBuilder {
static var integer_digits = '([0-9](_?[0-9])*)+';
static var integer = '([1-9](_?[0-9])*)|0';
static var hex_digits = '([0-9a-fA-F](_?[0-9a-fA-F])*)+';
static var bin_digits = '([01](_?[01])*)+';

static var integer_suffix = "(_?[iu](([1-9](_?[0-9])*)|0)+)?";
static var float_suffix = "(_?f(([1-9](_?[0-9])*)|0)+)?";
Expand All @@ -73,6 +74,7 @@ class HaxeLexer extends Lexer implements hxparse.RuleBuilder {
#end
},
"0x" + hex_digits + integer_suffix => mk(lexer, splitIntSuffix(lexer.current)),
"0b" + bin_digits + integer_suffix => mk(lexer, splitIntSuffix(lexer.current)),
integer + integer_suffix => mk(lexer, splitIntSuffix(lexer.current)),
integer + float_suffix => mk(lexer, splitFloatSuffix(lexer.current)),
integer + "\\." + integer_digits + float_suffix => mk(lexer, splitFloatSuffix(lexer.current)),
Expand All @@ -95,9 +97,7 @@ class HaxeLexer extends Lexer implements hxparse.RuleBuilder {
"<<=" => mk(lexer,Binop(OpAssignOp(OpShl))),
"|\\|=" => mk(lexer,Binop(OpAssignOp(OpBoolOr))),
"&&=" => mk(lexer,Binop(OpAssignOp(OpBoolAnd))),
#if (haxe >= version("4.3.0-rc.1"))
"?\\?=" => mk(lexer,Binop(OpAssignOp(OpNullCoal))),
#end
"==" => mk(lexer,Binop(OpEq)),
"!=" => mk(lexer,Binop(OpNotEq)),
"<=" => mk(lexer,Binop(OpLte)),
Expand Down Expand Up @@ -131,9 +131,7 @@ class HaxeLexer extends Lexer implements hxparse.RuleBuilder {
"}" => mk(lexer, BrClose),
"\\(" => mk(lexer, POpen),
"\\)" => mk(lexer, PClose),
#if (haxe >= version("4.3.0-rc.1"))
"?\\?" => mk(lexer,Binop(OpNullCoal)),
#end
"?" => mk(lexer, Question),
"@" => mk(lexer, At),
'"' => {
Expand Down
Loading

0 comments on commit a5fce2e

Please sign in to comment.