Skip to content

Commit

Permalink
lang-co/mode-coco: const/var
Browse files Browse the repository at this point in the history
  • Loading branch information
satyr committed Jun 27, 2012
1 parent f73c751 commit 3fee987
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion doc/lang-co.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extras/coco.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion extras/mode-coco.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions src/lang-co.co
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ tint = (ext, shortcuts, fallthroughs) ->
rule.splice 2 0 0 if rule.length < 4 for rule of shortcuts
PR.registerLangHandler PR.createSimpleLexer(shortcuts, fallthroughs), [ext]

ident = /(?:[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)/$
kwend = /(?![$\w\x7f-\uffff])/$
ident = /(?:(?!\d)(?:(?!\s)[\w$\xAA-\uFFDC])+)/$
kwend = /(?!(?!\s)[$\w\xAA-\uFFDC])/$

### Main
tint \co [
Expand Down Expand Up @@ -34,19 +34,20 @@ tint \co [
: t(?:ry|h(?:row|en)|ypeof!?)
| f(?:or(?:[^\n\S]+(?:own|ever))?|inally|unction)
| n(?:ew|ot)
| c(?:ontinue|a(?:se|tch)|lass)
| c(?:on(?:tinue|st)|a(?:se|tch)|lass)
| i(?:[fs]|n(?:stanceof)?|mport(?:[^\n\S]+all)?)
| e(?:lse|x(?:tends|port))
| d(?:e(?:fault|lete|bugger)|o)
| un(?:less|til)
| w(?:hile|ith)
| o[fr] | return | break | switch | and | let
| s(?:witch|uper)
| o[fr] | return | break | and | let | var
) #kwend //]
[\typ // ^ (?: true | false | null | void ) #kwend //]
[\ctx // ^ (?
: t(?:h(?:is|at)|o|il)
| f(?:rom|allthrough)
| it | arguments | eval | by | super | prototype
| it | arguments | eval | by | constructor | prototype | superclass
) #kwend //]
[\glb // ^ (?
: Array | Boolean | Date | Error | Function | JSON | Math | Number
Expand Down
12 changes: 6 additions & 6 deletions src/mode-coco.co
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

require, exports, module <-! define \ace/mode/coco

identifier = /[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*/$
identifier = /(?!\d)(?:(?!\s)[\w$\xAA-\uFFDC])+/$

exports.Mode = class CocoMode extends require(\ace/mode/text)Mode
->
Expand All @@ -17,7 +17,8 @@ exports.Mode = class CocoMode extends require(\ace/mode/text)Mode
: [({[=:]
| [-~]>
| \b (?: e(?:lse|xport) | d(?:o|efault) | t(?:ry|hen) | finally |
let | new | (?:catch|function) (?: \s* #identifier )? )
import (?:\s* all)? | const | var |
let | new | catch (?:\s* #identifier)? )
) \s* $ //

getNextLineIndent: (state, line, tab) ->
Expand Down Expand Up @@ -52,7 +53,7 @@ CocoMode.Rules =
* token: \keyword
regex: //(?
:t(?:h(?:is|row|en)|ry|ypeof!?)
|c(?:ontinue|a(?:se|tch)|lass)
|c(?:on(?:tinue|st)|a(?:se|tch)|lass)
|i(?:n(?:stanceof)?|mport(?:\s+all)?|[fs])
|d(?:e(?:fault|lete|bugger)|o)
|f(?:or(?:\s+own)?|inally|unction)
Expand All @@ -62,7 +63,7 @@ CocoMode.Rules =
|n(?:ew|ot)
|un(?:less|til)
|w(?:hile|ith)
|o[fr]|return|break|let
|o[fr]|return|break|let|var
)//$ + keywordend

* token: \constant.language
Expand All @@ -72,8 +73,7 @@ CocoMode.Rules =
regex: '(?
:p(?:ackage|r(?:ivate|otected)|ublic)
|i(?:mplements|nterface)
|e(?:num|xport)
|var|const|static|yield
|enum|static|yield
)' + keywordend

* token: \language.support.class
Expand Down
2 changes: 1 addition & 1 deletion test/ace.htm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
this is: not `JS`
void

var illegal
implements illegal
</pre

><script src=http://ajaxorg.github.com/ace/build/src/ace.js></script
Expand Down

0 comments on commit 3fee987

Please sign in to comment.