Compare commits
16 Commits
Author | SHA1 | Date |
---|---|---|
Derek Schmidt | 41dca29833 | |
theRemix | 9bacfaa695 | |
theRemix | 77e901fab7 | |
Jon Borgonia | 510965fefe | |
theRemix | 65b71e0494 | |
tong | b4a0bd085d | |
tong | f1c0f0ebe2 | |
tong | 0281d182e4 | |
tong | ced3ed06a5 | |
tong | ec8ec0f138 | |
tong | 09ca683171 | |
tong | 350f2d2e75 | |
tong | 12d4e775a9 | |
tong | 086a9dfed3 | |
tong | b631dd3bf8 | |
tong | 20527cab89 |
|
@ -1,3 +1,11 @@
|
||||||
|
## 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
|
## 0.5.3
|
||||||
* Snippets: remove unnecessary line endings
|
* Snippets: remove unnecessary line endings
|
||||||
* Snippets: description urls for Array/List/Map
|
* Snippets: description urls for Array/List/Map
|
||||||
|
|
|
@ -2,6 +2,25 @@
|
||||||
'name': 'Haxe'
|
'name': 'Haxe'
|
||||||
'comment': 'Haxe Syntax: version 3.3.0'
|
'comment': 'Haxe Syntax: version 3.3.0'
|
||||||
'fileTypes': ['hx']
|
'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)'
|
'foldingStartMarker': '(\\{\\s*(//.*)?$|^\\s*// \\{\\{\\{|#if)'
|
||||||
'foldingStopMarker': '^\\s*(\\}|// \\}\\}\\}$|#end)'
|
'foldingStopMarker': '^\\s*(\\}|// \\}\\}\\}$|#end)'
|
||||||
'patterns': [
|
'patterns': [
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
'scopeName': 'source.haxelib'
|
||||||
|
'fileTypes': ['json']
|
||||||
|
'name': 'haxelib'
|
||||||
|
'patterns': [
|
||||||
|
{ 'include': 'source.json' }
|
||||||
|
]
|
|
@ -0,0 +1,63 @@
|
||||||
|
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'
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"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",
|
"name": "language-haxe",
|
||||||
"version": "0.5.4",
|
"version": "0.6.0",
|
||||||
"description": "Haxe language support in Atom",
|
"description": "Haxe language support in Atom",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"haxe",
|
"haxe",
|
||||||
|
@ -19,5 +19,7 @@
|
||||||
"atom": ">=1.5.0 <2.0.0",
|
"atom": ">=1.5.0 <2.0.0",
|
||||||
"node": "*"
|
"node": "*"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {
|
||||||
|
"tree-sitter-haxe": "^0.1.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,36 +2,30 @@
|
||||||
|
|
||||||
'#if':
|
'#if':
|
||||||
'prefix': '#if'
|
'prefix': '#if'
|
||||||
'body': '#if ${1:define}\n#end\n$0'
|
'body': '#if ${1:<flag>}\n#end$0'
|
||||||
'description': 'Conditional Compilation'
|
'description': 'Conditional Compilation'
|
||||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||||
'#else':
|
'#else':
|
||||||
'prefix': '#else'
|
'prefix': '#else'
|
||||||
'body': '#else\n$0'
|
'body': '#else$0'
|
||||||
'description': 'Conditional Compilation'
|
'description': 'Conditional Compilation'
|
||||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||||
'#elseif':
|
'#elseif':
|
||||||
'prefix': '#elseif'
|
'prefix': '#elseif'
|
||||||
'body': '#elseif ${1:define}\n${2}$0'
|
'body': '#elseif ${1:<flag>}$0'
|
||||||
'description': 'Conditional Compilation'
|
'description': 'Conditional Compilation'
|
||||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||||
'#end':
|
'#end':
|
||||||
'prefix': '#end'
|
'prefix': '#end'
|
||||||
'body': '#end\n$0'
|
'body': '#end$0'
|
||||||
'description': 'Conditional Compilation'
|
'description': 'Conditional Compilation'
|
||||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
||||||
'#else error':
|
'#else error':
|
||||||
'prefix': '#error'
|
'prefix': '#error'
|
||||||
'body': '#error "${1:define}"$0'
|
'body': '#error "${1:<flag>}"$0'
|
||||||
'description': 'Conditional Compilation'
|
'description': 'Conditional Compilation'
|
||||||
'descriptionMoreURL': 'http://haxe.org/manual/lf-condition-compilation.html'
|
'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':
|
'Line Comment Start':
|
||||||
'prefix': '//'
|
'prefix': '//'
|
||||||
'body': '// ${1:}$0'
|
'body': '// ${1:}$0'
|
||||||
|
@ -40,6 +34,12 @@
|
||||||
'body': '/**\n\t$1\n*/$0'
|
'body': '/**\n\t$1\n*/$0'
|
||||||
'description': 'Block comment'
|
'description': 'Block comment'
|
||||||
|
|
||||||
|
'trace':
|
||||||
|
'prefix': 'trace'
|
||||||
|
'body': 'trace( $1 )$0'
|
||||||
|
'description': 'Print information'
|
||||||
|
'descriptionMoreURL': 'http://haxe.org/manual/lf-trace-log.html'
|
||||||
|
|
||||||
'true':
|
'true':
|
||||||
'prefix': 'true'
|
'prefix': 'true'
|
||||||
'body': 'true'
|
'body': 'true'
|
||||||
|
@ -64,6 +64,11 @@
|
||||||
'body': 'import ${1:<package>};$0'
|
'body': 'import ${1:<package>};$0'
|
||||||
'description': 'Allow omitting the package name when using a type'
|
'description': 'Allow omitting the package name when using a type'
|
||||||
'descriptionMoreURL': 'http://haxe.org/manual/type-system-import.html'
|
'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':
|
'private':
|
||||||
'prefix': 'private'
|
'prefix': 'private'
|
||||||
'body': 'private '
|
'body': 'private '
|
||||||
|
@ -73,6 +78,8 @@
|
||||||
'inline':
|
'inline':
|
||||||
'prefix': 'inline'
|
'prefix': 'inline'
|
||||||
'body': 'inline '
|
'body': 'inline '
|
||||||
|
'description': 'Allow insert function body in place'
|
||||||
|
'descriptionMoreURL': 'https://haxe.org/manual/class-field-inline.html'
|
||||||
'static':
|
'static':
|
||||||
'prefix': 'static'
|
'prefix': 'static'
|
||||||
'body': 'static '
|
'body': 'static '
|
||||||
|
@ -101,28 +108,27 @@
|
||||||
'body': 'default:\n\t${1:statement}'
|
'body': 'default:\n\t${1:statement}'
|
||||||
'return':
|
'return':
|
||||||
'prefix': 'return'
|
'prefix': 'return'
|
||||||
'body': 'return $1;$0'
|
'body': 'return$0'
|
||||||
|
|
||||||
'while':
|
'while':
|
||||||
'prefix': 'while'
|
'prefix': 'while'
|
||||||
'body': 'while( ${1:true} ) {\n\t$2\n}$0'
|
'body': 'while( ${1:true} ) {\n\t$2\n}$0'
|
||||||
|
|
||||||
'do..while':
|
'do..while':
|
||||||
'prefix': 'do '
|
'prefix': 'do '
|
||||||
'body': 'do {\n\t$1\n} while( ${2:true} );$0'
|
'body': 'do {\n\t$1\n} while( ${2:true} );$0'
|
||||||
'continue':
|
'continue':
|
||||||
'prefix': 'continue'
|
'prefix': 'continue'
|
||||||
'body': 'continue;\n$0'
|
'body': 'continue;$0'
|
||||||
'break':
|
'break':
|
||||||
'prefix': 'break'
|
'prefix': 'break'
|
||||||
'body': 'break;'
|
'body': 'break;'
|
||||||
|
|
||||||
'for i in 0...end':
|
'for i in 0...end':
|
||||||
'prefix': 'fori'
|
'prefix': 'fori'
|
||||||
'body': 'for( ${1:var} in ${2:0}...${3:end} ) {\n\t${4:expr}\n}\n$0'
|
'body': 'for( ${1:var} in ${2:0}...${3:end} ) {\n\t${4:expr}\n}$0'
|
||||||
'for a in b':
|
'for a in b':
|
||||||
'prefix': 'for'
|
'prefix': 'for'
|
||||||
'body': 'for( $1 in $2 ) {\n\t$3\n}\n$0'
|
'body': 'for( ${1:value} in ${2:iterable} ) {\n\t$3\n}\n$0'
|
||||||
|
|
||||||
'try':
|
'try':
|
||||||
'prefix': 'try'
|
'prefix': 'try'
|
||||||
|
@ -134,6 +140,13 @@
|
||||||
'prefix': 'throw'
|
'prefix': 'throw'
|
||||||
'body': 'throw ${1:expr};$0'
|
'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':
|
'autotyped var':
|
||||||
'prefix': 'v'
|
'prefix': 'v'
|
||||||
'body': 'var ${1:name} ${2:: ${3:Type}}${4: = }$5;$0'
|
'body': 'var ${1:name} ${2:: ${3:Type}}${4: = }$5;$0'
|
||||||
|
@ -169,6 +182,9 @@
|
||||||
'prefix': 'set_'
|
'prefix': 'set_'
|
||||||
'body': 'function set_${1:name}(${2:v}:${3:Type}) : ${3:Type} \{\n\treturn $4;\n\}$0'
|
'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':
|
'function':
|
||||||
'prefix': 'function'
|
'prefix': 'function'
|
||||||
'body': 'function ${1:name}( ${2:params} )${3: : ${4:Void}} \{\n\t$5\n\}$0'
|
'body': 'function ${1:name}( ${2:params} )${3: : ${4:Void}} \{\n\t$5\n\}$0'
|
||||||
|
@ -255,16 +271,83 @@
|
||||||
'body': 'Array<${1:T}>$0'
|
'body': 'Array<${1:T}>$0'
|
||||||
'description': 'Collection of elements'
|
'description': 'Collection of elements'
|
||||||
'descriptionMoreURL': 'http://api.haxe.org/Array.html'
|
'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>':
|
'Class<T>':
|
||||||
'prefix': 'Class'
|
'prefix': 'Class'
|
||||||
'body': 'Class<${1:T}>$0'
|
'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>':
|
'List<T>':
|
||||||
'prefix': 'List'
|
'prefix': 'List'
|
||||||
'body': 'List<${1:T}>$0'
|
'body': 'List<${1:T}>$0'
|
||||||
'description': 'A linked-list of elements'
|
'description': 'A linked-list of elements'
|
||||||
'descriptionMoreURL': 'http://api.haxe.org/List.html'
|
'descriptionMoreURL': 'http://api.haxe.org/List.html'
|
||||||
'Map<K,V>':
|
'Map<K,V>':
|
||||||
'prefix': 'Map'
|
'prefix': 'Map<K,V>'
|
||||||
'body': 'Map<${1:K},${2:V}>$0'
|
'body': 'Map<${1:K},${2:V}>$0'
|
||||||
'description': 'Key to value mapping for arbitrary value types'
|
'description': 'Key to value mapping for arbitrary value types'
|
||||||
'descriptionMoreURL': 'http://api.haxe.org/Map.html'
|
'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,3 +81,35 @@ describe "Haxe Grammar", ->
|
||||||
{tokens} = grammar.tokenizeLine('a.push(' + delim + 'x' + delim + ' + y + ' + delim + ':function()' + delim + ');')
|
{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[0]).toEqual value: 'a', scopes: ['source.haxe'] #,'meta.scope.field-completions.haxe']
|
||||||
#expect(tokens[1]).toEqual value: '.', scopes: ['source.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