Compare commits
No commits in common. "master" and "v0.5.4" have entirely different histories.
|
@ -1,11 +1,3 @@
|
|||
## 0.6.0
|
||||
* Snippets: cast, dynamic, using
|
||||
* Snippets: std library top level definitions
|
||||
* Grammars: recognises interpreter directives, emacs modelines, vim modelines
|
||||
|
||||
## 0.5.4
|
||||
* Update grammar to haxe 3.4.0-rc.1
|
||||
|
||||
## 0.5.3
|
||||
* Snippets: remove unnecessary line endings
|
||||
* Snippets: description urls for Array/List/Map
|
||||
|
|
|
@ -2,25 +2,6 @@
|
|||
'name': 'Haxe'
|
||||
'comment': 'Haxe Syntax: version 3.3.0'
|
||||
'fileTypes': ['hx']
|
||||
'firstLineMatch': '''(?x)
|
||||
# Hashbang
|
||||
^\\#!.*(?:\\s|\\/)
|
||||
haxe
|
||||
(?:$|\\s)
|
||||
|
|
||||
# Modeline
|
||||
(?i:
|
||||
# Emacs
|
||||
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
|
||||
haxe
|
||||
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
|
||||
|
|
||||
# Vim
|
||||
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
|
||||
haxe
|
||||
(?=\\s|:|$)
|
||||
)
|
||||
'''
|
||||
'foldingStartMarker': '(\\{\\s*(//.*)?$|^\\s*// \\{\\{\\{|#if)'
|
||||
'foldingStopMarker': '^\\s*(\\}|// \\}\\}\\}$|#end)'
|
||||
'patterns': [
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
'scopeName': 'source.haxelib'
|
||||
'fileTypes': ['json']
|
||||
'name': 'haxelib'
|
||||
'patterns': [
|
||||
{ 'include': 'source.json' }
|
||||
]
|
|
@ -1,63 +0,0 @@
|
|||
name: 'Haxe'
|
||||
scopeName: 'source.haxe'
|
||||
type: 'tree-sitter'
|
||||
parser: 'tree-sitter-haxe'
|
||||
fileTypes: ['hx']
|
||||
firstLineMatch: '''(?x)
|
||||
# Hashbang
|
||||
^\\#!.*(?:\\s|\\/)
|
||||
haxe
|
||||
(?:$|\\s)
|
||||
|
|
||||
# Modeline
|
||||
(?i:
|
||||
# Emacs
|
||||
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
|
||||
haxe
|
||||
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
|
||||
|
|
||||
# Vim
|
||||
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
|
||||
haxe
|
||||
(?=\\s|:|$)
|
||||
)
|
||||
'''
|
||||
|
||||
folds: [
|
||||
{ type: 'comment' }
|
||||
]
|
||||
|
||||
comments:
|
||||
start: '// '
|
||||
|
||||
scopes:
|
||||
'module': 'source.haxe'
|
||||
|
||||
'comment': 'comment.line.double-slash.haxe'
|
||||
'keyword': 'keyword.control'
|
||||
|
||||
'package_statement > keyword': 'keyword.package.haxe'
|
||||
'import_statement > keyword': 'storage.import.haxe'
|
||||
'import_statement > attribute > identifier': 'entity.name.type.import.haxe'
|
||||
|
||||
'class_declaration > keyword': 'storage.class.haxe'
|
||||
'class_declaration > identifier': 'entity.name.type.class.haxe'
|
||||
'class_declaration > attribute > identifier': 'entity.other.inherited-class.haxe'
|
||||
|
||||
'function_declaration > keyword': 'keyword.function.haxe'
|
||||
'function_declaration > identifier': 'entity.name.type.function.haxe'
|
||||
|
||||
'variable_declaration > keyword': 'keyword.variable.haxe'
|
||||
|
||||
'call > attribute:nth-child(0) > identifier': [
|
||||
{ match: 'super|trace', scopes: 'support.function.haxe'},
|
||||
{ match: '^[A-Z]', scopes: 'support.type.contructor' },
|
||||
'entity.name.function',
|
||||
]
|
||||
|
||||
'attribute > identifier': [
|
||||
{ match: '^[A-Z]', scopes: 'entity.name.type.package' },
|
||||
{ match: 'this|super', scopes: 'variable.language.haxe' },
|
||||
]
|
||||
|
||||
'type > identifier': 'support.storage.type'
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"name": "language-haxe",
|
||||
"version": "0.6.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"nan": {
|
||||
"version": "2.15.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
|
||||
"integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
|
||||
},
|
||||
"tree-sitter-haxe": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tree-sitter-haxe/-/tree-sitter-haxe-0.1.0.tgz",
|
||||
"integrity": "sha512-uhzG4GtA21mZhc38dstae3XLmiFYF0HfW82PLqIZ7E7nUZV3un208BiB0iOTv/uLHv3VyvNPOAVeEQ1eNL+ulQ==",
|
||||
"requires": {
|
||||
"nan": "^2.14.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "language-haxe",
|
||||
"version": "0.6.0",
|
||||
"version": "0.5.4",
|
||||
"description": "Haxe language support in Atom",
|
||||
"keywords": [
|
||||
"haxe",
|
||||
|
@ -19,7 +19,5 @@
|
|||
"atom": ">=1.5.0 <2.0.0",
|
||||
"node": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"tree-sitter-haxe": "^0.1.0"
|
||||
}
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -2,30 +2,36 @@
|
|||
|
||||
'#if':
|
||||
'prefix': '#if'
|
||||
'body': '#if ${1:<flag>}\n#end$0'
|
||||
'body': '#if ${1:define}\n#end\n$0'
|
||||
'description': 'Conditional Compilation'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||
'#else':
|
||||
'prefix': '#else'
|
||||
'body': '#else$0'
|
||||
'body': '#else\n$0'
|
||||
'description': 'Conditional Compilation'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||
'#elseif':
|
||||
'prefix': '#elseif'
|
||||
'body': '#elseif ${1:<flag>}$0'
|
||||
'body': '#elseif ${1:define}\n${2}$0'
|
||||
'description': 'Conditional Compilation'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||
'#end':
|
||||
'prefix': '#end'
|
||||
'body': '#end$0'
|
||||
'body': '#end\n$0'
|
||||
'description': 'Conditional Compilation'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||
'#else error':
|
||||
'prefix': '#error'
|
||||
'body': '#error "${1:<flag>}"$0'
|
||||
'body': '#error "${1:define}"$0'
|
||||
'description': 'Conditional Compilation'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||
|
||||
'trace':
|
||||
'prefix': 'trace'
|
||||
'body': 'trace( $1 );$0'
|
||||
'description': 'Print information'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-trace-log.html'
|
||||
|
||||
'Line Comment Start':
|
||||
'prefix': '//'
|
||||
'body': '// ${1:}$0'
|
||||
|
@ -34,12 +40,6 @@
|
|||
'body': '/**\n\t$1\n*/$0'
|
||||
'description': 'Block comment'
|
||||
|
||||
'trace':
|
||||
'prefix': 'trace'
|
||||
'body': 'trace( $1 )$0'
|
||||
'description': 'Print information'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-trace-log.html'
|
||||
|
||||
'true':
|
||||
'prefix': 'true'
|
||||
'body': 'true'
|
||||
|
@ -64,11 +64,6 @@
|
|||
'body': 'import ${1:<package>};$0'
|
||||
'description': 'Allow omitting the package name when using a type'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/type-system-import.html'
|
||||
'using':
|
||||
'prefix': 'using'
|
||||
'body': 'using ${1:<package>};$0'
|
||||
'description': 'Pseudo-extend existing types without modifying their source'
|
||||
'descriptionMoreURL': 'https://haxe.org/manual/lf-static-extension.html'
|
||||
'private':
|
||||
'prefix': 'private'
|
||||
'body': 'private '
|
||||
|
@ -78,8 +73,6 @@
|
|||
'inline':
|
||||
'prefix': 'inline'
|
||||
'body': 'inline '
|
||||
'description': 'Allow insert function body in place'
|
||||
'descriptionMoreURL': 'https://haxe.org/manual/class-field-inline.html'
|
||||
'static':
|
||||
'prefix': 'static'
|
||||
'body': 'static '
|
||||
|
@ -108,27 +101,28 @@
|
|||
'body': 'default:\n\t${1:statement}'
|
||||
'return':
|
||||
'prefix': 'return'
|
||||
'body': 'return$0'
|
||||
'body': 'return $1;$0'
|
||||
|
||||
'while':
|
||||
'prefix': 'while'
|
||||
'body': 'while( ${1:true} ) {\n\t$2\n}$0'
|
||||
|
||||
'do..while':
|
||||
'prefix': 'do '
|
||||
'body': 'do {\n\t$1\n} while( ${2:true} );$0'
|
||||
'continue':
|
||||
'prefix': 'continue'
|
||||
'body': 'continue;$0'
|
||||
'body': 'continue;\n$0'
|
||||
'break':
|
||||
'prefix': 'break'
|
||||
'body': 'break;'
|
||||
|
||||
'for i in 0...end':
|
||||
'prefix': 'fori'
|
||||
'body': 'for( ${1:var} in ${2:0}...${3:end} ) {\n\t${4:expr}\n}$0'
|
||||
'body': 'for( ${1:var} in ${2:0}...${3:end} ) {\n\t${4:expr}\n}\n$0'
|
||||
'for a in b':
|
||||
'prefix': 'for'
|
||||
'body': 'for( ${1:value} in ${2:iterable} ) {\n\t$3\n}\n$0'
|
||||
'body': 'for( $1 in $2 ) {\n\t$3\n}\n$0'
|
||||
|
||||
'try':
|
||||
'prefix': 'try'
|
||||
|
@ -140,13 +134,6 @@
|
|||
'prefix': 'throw'
|
||||
'body': 'throw ${1:expr};$0'
|
||||
|
||||
'cast':
|
||||
'prefix': 'cast'
|
||||
'body': 'cast( ${1:expr}, ${2:type} )$0'
|
||||
'cast ':
|
||||
'prefix': 'cast '
|
||||
'body': 'cast ${1:expr}$0'
|
||||
|
||||
'autotyped var':
|
||||
'prefix': 'v'
|
||||
'body': 'var ${1:name} ${2:: ${3:Type}}${4: = }$5;$0'
|
||||
|
@ -182,9 +169,6 @@
|
|||
'prefix': 'set_'
|
||||
'body': 'function set_${1:name}(${2:v}:${3:Type}) : ${3:Type} \{\n\treturn $4;\n\}$0'
|
||||
|
||||
'dynamic':
|
||||
'prefix': 'dynamic function'
|
||||
'body': 'dynamic function ${1:<name>}($2) {}$0'
|
||||
'function':
|
||||
'prefix': 'function'
|
||||
'body': 'function ${1:name}( ${2:params} )${3: : ${4:Void}} \{\n\t$5\n\}$0'
|
||||
|
@ -271,83 +255,16 @@
|
|||
'body': 'Array<${1:T}>$0'
|
||||
'description': 'Collection of elements'
|
||||
'descriptionMoreURL': 'http://api.haxe.org/Array.html'
|
||||
'ArrayAccess<T>':
|
||||
'prefix': 'ArrayAccess<T>'
|
||||
'body': 'ArrayAccess<${1:T}>$0'
|
||||
'Bool':
|
||||
'prefix': 'Bool'
|
||||
'body': 'Bool$0'
|
||||
'Class<T>':
|
||||
'prefix': 'Class'
|
||||
'body': 'Class<${1:T}>$0'
|
||||
'Date':
|
||||
'prefix': 'Date'
|
||||
'body': 'Date$0'
|
||||
'Dynamic':
|
||||
'prefix': 'Dynamic'
|
||||
'body': 'Dynamic$0'
|
||||
'EReg':
|
||||
'prefix': 'EReg'
|
||||
'body': 'EReg( ${1:r}, ${2:opt} )$0'
|
||||
'Float':
|
||||
'prefix': 'Float'
|
||||
'body': 'Float$0'
|
||||
'Int':
|
||||
'prefix': 'Int'
|
||||
'body': 'Int$0'
|
||||
'List<T>':
|
||||
'prefix': 'List'
|
||||
'body': 'List<${1:T}>$0'
|
||||
'description': 'A linked-list of elements'
|
||||
'descriptionMoreURL': 'http://api.haxe.org/List.html'
|
||||
'Map<K,V>':
|
||||
'prefix': 'Map<K,V>'
|
||||
'prefix': 'Map'
|
||||
'body': 'Map<${1:K},${2:V}>$0'
|
||||
'description': 'Key to value mapping for arbitrary value types'
|
||||
'descriptionMoreURL': 'http://api.haxe.org/Map.html'
|
||||
'Math':
|
||||
'prefix': 'Math'
|
||||
'body': 'Math$0'
|
||||
'Null<T>':
|
||||
'prefix': 'Null<T>'
|
||||
'body': 'Null<${1:T}>$0'
|
||||
'Reflect':
|
||||
'prefix': 'Reflect'
|
||||
'body': 'Reflect.$0'
|
||||
'description': 'Runtime reflection of types and fields'
|
||||
'descriptionMoreURL': 'http://haxe.org/manual/std-reflection.html'
|
||||
'Single':
|
||||
'prefix': 'Single'
|
||||
'body': 'Single$0'
|
||||
'description': 'Single-precision IEEE 32bit float (4-byte)'
|
||||
'Std':
|
||||
'prefix': 'Std'
|
||||
'body': 'Std.$0'
|
||||
'description': 'Standard methods for manipulating basic types'
|
||||
'String':
|
||||
'prefix': 'String'
|
||||
'body': 'String$0'
|
||||
'StringBuf':
|
||||
'prefix': 'StringBuf'
|
||||
'body': 'StringBuf$0'
|
||||
'StringTools':
|
||||
'prefix': 'StringTools'
|
||||
'body': 'StringTools$0'
|
||||
'Type':
|
||||
'prefix': 'Type'
|
||||
'body': 'Type$0'
|
||||
'UInt':
|
||||
'prefix': 'UInt'
|
||||
'body': 'UInt$0'
|
||||
'ValueType':
|
||||
'prefix': 'ValueType'
|
||||
'body': 'ValueType$0'
|
||||
'Void':
|
||||
'prefix': 'Void'
|
||||
'body': 'Void$0'
|
||||
'Xml':
|
||||
'prefix': 'Xml'
|
||||
'body': 'Xml$0'
|
||||
'XmlType':
|
||||
'prefix': 'XmlType'
|
||||
'body': 'XmlType$0'
|
||||
|
|
|
@ -81,35 +81,3 @@ describe "Haxe Grammar", ->
|
|||
{tokens} = grammar.tokenizeLine('a.push(' + delim + 'x' + delim + ' + y + ' + delim + ':function()' + delim + ');')
|
||||
expect(tokens[0]).toEqual value: 'a', scopes: ['source.haxe'] #,'meta.scope.field-completions.haxe']
|
||||
#expect(tokens[1]).toEqual value: '.', scopes: ['source.haxe']
|
||||
|
||||
describe "firstLineMatch", ->
|
||||
it "recognises interpreter directives", ->
|
||||
valid = """
|
||||
#!/usr/sbin/haxe
|
||||
#!/usr/bin/haxe foo=bar/
|
||||
#!/usr/sbin/haxe
|
||||
#!/usr/sbin/haxe foo bar baz
|
||||
#!/usr/bin/haxe perl
|
||||
#!/usr/bin/haxe bin/perl
|
||||
#!/usr/bin/haxe
|
||||
#!/bin/haxe
|
||||
#!/usr/bin/haxe --script=usr/bin
|
||||
#! /usr/bin/env A=003 B=149 C=150 D=xzd E=base64 F=tar G=gz H=head I=tail haxe
|
||||
#!\t/usr/bin/env --foo=bar haxe --quu=quux
|
||||
#! /usr/bin/haxe
|
||||
#!/usr/bin/env haxe
|
||||
"""
|
||||
for line in valid.split /\n/
|
||||
expect( grammar.firstLineRegex.scanner.findNextMatchSync( line ) ).not.toBeNull()
|
||||
invalid = """
|
||||
\x20#!/usr/sbin/haxe
|
||||
\t#!/usr/sbin/haxe
|
||||
#!/usr/bin/env-haxe/node-env/
|
||||
#!/usr/bin/env-haxe
|
||||
#! /usr/binhaxe
|
||||
#!\t/usr/bin/env --haxe=bar
|
||||
"""
|
||||
for line in invalid.split /\n/
|
||||
expect( grammar.firstLineRegex.scanner.findNextMatchSync( line ) ).toBeNull()
|
||||
#it "recognises Emacs modelines", ->
|
||||
#it "recognises Vim modelines", ->
|
||||
|
|
Loading…
Reference in New Issue