broomhlda 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3a9585d07f566041aaa2f64eb3c39d8549659b0
4
- data.tar.gz: f177b9a4c5037651d946fed5b778701199732973
3
+ metadata.gz: 5841f61e93c8c3411d7941da19ccf65387695007
4
+ data.tar.gz: ecc7612997c65556d44c23a7b8b581e6a5c7ffa9
5
5
  SHA512:
6
- metadata.gz: db598fbeb791fb044348c1a28925edee938c043ed4a235170b6ac2c4c90c7059e1d8ae6e98c371d1b3209c76e420975667b3222f37636c726d51ab058a51d152
7
- data.tar.gz: 8cc5f90657ff5fcf48e722bc0daa958bceb7f449d17f17b3153e74fb39b8c3ff21453546bec350d9a4a32c90d6f845b544c9e85ea039775e7762a09469bcf93e
6
+ metadata.gz: 3dc935718a23fe89c7c9e1ce166d70679098836c14afd10d86a90d16fed739dd67f2e949af795900503521ca5eadbd2881db32b98297b6af719e932f2fefcb52
7
+ data.tar.gz: 2a8f6a62d8005ba9404b69983c4cd8e1aca320056d2d60ce298fce3a8a8474de2f2283081d36ab5976646a03a2f7462bb73ca6da4dde425c21007179d18d3a9c
@@ -0,0 +1,63 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "Bash"
6
+ aliases: ["bash", "sh", "ksh"]
7
+ extensions: [".sh", ".ksh", ".bash", ".ebuild", ".eclass", ".bashrc", "bashrc", ".bash_", "bash_"]
8
+ mimetypes: ["application/x-sh", "application/x-shellscript"]
9
+ start: .root
10
+ flags: 0
11
+
12
+ lex(curly):
13
+ r"}" is(keyword) -> pop
14
+ r":-" is(keyword)
15
+ r"[a-zA-Z0-9_]+" is(name.variable)
16
+ r"[^}:\"\'`$]+" is(punctuation)
17
+ r":" is(punctuation)
18
+ any-of(root)
19
+
20
+ lex(backticks):
21
+ r"`" is(literal.string.backtick) -> pop
22
+ any-of(root)
23
+
24
+ lex(root):
25
+ any-of(basic)
26
+ r"\$\(\(" is(keyword) -> go-to(math)
27
+ r"\$\(" is(keyword) -> go-to(paren)
28
+ r"\${\#?" is(keyword) -> go-to(curly)
29
+ r"`" is(literal.string.backtick) -> go-to(backticks)
30
+ any-of(data)
31
+
32
+ lex(basic):
33
+ r"\b(if|fi|else|while|do|done|for|then|return|function|case|select|continue|until|esac|elif)\s*\b" is(keyword)
34
+ r"\b(alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|time|times|trap|true|type|typeset|ulimit|umask|unalias|unset|wait)\s*\b(?!\.)" is(name.builtin)
35
+ r"\#.*$" is(comment)
36
+ r"\\[\w\W]" is(literal.string.escape)
37
+ r"(\b\w+)(\s*)(=)" is(by-groups(name.variable, text, operator))
38
+ r"[\[\]{}()=]" is(operator)
39
+ r"<<<" is(operator)
40
+ r"<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2" is(literal.string)
41
+ r"&&|\|\|" is(operator)
42
+
43
+ lex(paren):
44
+ r"\)" is(keyword) -> pop
45
+ any-of(root)
46
+
47
+ lex(data):
48
+ r"(?m)\$?\"(\\\\|\\[0-7]+|\\.|[^\"\\])*\"" is(literal.string.double)
49
+ r"(?m)\$?'(\\\\|\\[0-7]+|\\.|[^'\\])*'" is(literal.string.single)
50
+ r";" is(text)
51
+ r"\s+" is(text)
52
+ r"[^=\s\[\]{}()$\"\'`\\<]+" is(text)
53
+ r"\d+(?= |\Z)" is(literal.number)
54
+ r"\$\#?(\w+|.)" is(name.variable)
55
+ r"<" is(text)
56
+
57
+ lex(math):
58
+ r"\)\)" is(keyword) -> pop
59
+ r"[-+*/%^|&]|\*\*|\|\|" is(operator)
60
+ r"\d+" is(literal.number)
61
+ any-of(root)
62
+
63
+ const-set(.Lexer, lexer)
@@ -126,7 +126,7 @@ lexer = lexer:
126
126
 
127
127
  lex(block-line):
128
128
  -- the line end
129
- r"[ ]*(?=#|$)" is(text) -> pop -- something(Text)
129
+ r"[ ]*(?=#|$)" is(text) -> pop
130
130
 
131
131
  -- whitespaces separating tokens
132
132
  r"[ ]+" is(text)
@@ -141,7 +141,7 @@ lexer = lexer:
141
141
  any-of(flow-nodes)
142
142
 
143
143
  -- a plain scalar
144
- r"(?=[^\s?:,\[\]{}#&*!|>'\"%@`-]|[?:-]\S)" is(name.variable) => plain-scalar-in-block-context -- something(Name.Variable)
144
+ r"(?=[^\s?:,\[\]{}#&*!|>'\"%@`-]|[?:-]\S)" is(name.variable) => plain-scalar-in-block-context
145
145
 
146
146
 
147
147
  lex(descriptors):
@@ -307,7 +307,7 @@ lexer = lexer:
307
307
 
308
308
  lex(plain-scalar-in-block-context):
309
309
  -- the scalar ends with the ':' indicator
310
- r"[ ]*(?=:[ ]|:$)" is(text) -> pop -- something(Text)
310
+ r"[ ]*(?=:[ ]|:$)" is(text) -> pop
311
311
 
312
312
  -- the scalar ends with whitespaces followed by a comment
313
313
  r"[ ]+(?=#)" is(text) -> pop
@@ -321,13 +321,18 @@ lexer = lexer:
321
321
  -- other whitespaces are a part of the value
322
322
  r"[ ]+" is(literal.scalar.plain)
323
323
 
324
+ any-of(constants)
325
+
326
+ -- regular non-whitespace characters acting as a key
327
+ r"(?::(?!\s)|[^\s:])+(?=:( |$))" is(name.property)
328
+
324
329
  -- regular non-whitespace characters
325
- r"(?::(?!\s)|[^\s:])+" is(name.property) --literal.scalar.plain)
330
+ r"(?::(?!\s)|[^\s:])+" is(name.variable)
326
331
 
327
332
 
328
333
  lex(plain-scalar-in-flow-context):
329
334
  -- the scalar ends with an indicator character
330
- r"[ ]*(?=[,:?\[\]{}])" is(text) -> pop -- something(Text)
335
+ r"[ ]*(?=[,:?\[\]{}])" is(text) -> pop
331
336
 
332
337
  -- the scalar ends with a comment
333
338
  r"[ ]+(?=#)" is(text) -> pop
@@ -342,7 +347,18 @@ lexer = lexer:
342
347
  -- other whitespaces are a part of the value
343
348
  r"[ ]+" is(name.variable)
344
349
 
350
+ any-of(constants)
351
+
352
+ -- regular non-whitespace characters acting as a key
353
+ r"[^\s,:?\[\]{}]+(?=:( |$))" is(name.property)
354
+
345
355
  -- regular non-whitespace characters
346
356
  r"[^\s,:?\[\]{}]+" is(name.variable)
347
357
 
358
+
359
+ lex(constants):
360
+ r"\b(~|null|Null|NULL)\b" is(keyword.constant)
361
+ r"\b(y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)\b" is(keyword.constant)
362
+
363
+
348
364
  const-set(.Lexer, lexer)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: broomhlda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Suraci
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-12 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: atomy
@@ -52,6 +52,7 @@ files:
52
52
  - lib/hl/formatters/html.ay
53
53
  - lib/hl/lexer.ay
54
54
  - lib/hl/lexers/atomy.ay
55
+ - lib/hl/lexers/bash.ay
55
56
  - lib/hl/lexers/haskell.ay
56
57
  - lib/hl/lexers/imported/abap.ay
57
58
  - lib/hl/lexers/imported/actionscript.ay