Skip to content

Commit

Permalink
v. 2.5.0 update, Codemirror 5.8.1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikos M committed Oct 25, 2015
1 parent 7476d98 commit 5d9bea9
Show file tree
Hide file tree
Showing 42 changed files with 7,278 additions and 3,952 deletions.
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ var xml_grammar = {
,"doctype" : "meta"
,"meta" : "meta"
,"cdata" : "atom"
,"open_tag" : "tag"
,"close_tag" : "tag"
,"tag" : "tag"
,"attribute" : "attribute"
,"string" : "string"
,"atom" : "atom"
Expand Down Expand Up @@ -131,8 +130,8 @@ var xml_grammar = {
"Syntax" : {

"tag_att" : "'id'.attribute unique_att '=' string unique_id | attribute unique_att '=' (string | number)"
,"start_tag" : "open_tag tag_ctx tag_opened tag_att* ('>'.tag | '/>'.tag tag_autoclosed) \\tag_ctx"
,"end_tag" : "close_tag tag_closed"
,"start_tag" : "open_tag.tag tag_ctx tag_opened tag_att* ('>'.tag | '/>'.tag tag_autoclosed) \\tag_ctx"
,"end_tag" : "close_tag.tag tag_closed"
,"xml" : "(^^1 declaration? doctype?) (declaration.error out_of_place | doctype.error out_of_place | comment | meta | cdata | start_tag | end_tag | atom | text)*"

},
Expand All @@ -159,23 +158,21 @@ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {

Result:

![xml-grammar-1](/test/grammar-xml-annotations-1.png)
![xml-grammar-2](/test/grammar-xml-annotations-2.png)
![xml-grammar-1](/test/grammar-xml.png)
![xml-grammar-2](/test/grammar-xml-2.png)



###Other Examples:


![js-recursive-grammar](/test/grammar-js-recursion.png)
![js-recursive-grammar](/test/grammar-js-recursion-2.png)

![js-recursive-grammar-autocomplete](/test/grammar-js-recursion-2.png)

![css-grammar](/test/grammar-css.png)


![python-grammar](/test/grammar-python.png)


![php-grammar](/test/grammar-php.png)

![scheme-grammar](/test/grammar-scheme.png)
12 changes: 12 additions & 0 deletions api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,16 @@ mode = CodeMirrorGrammar.getMode( grammar [, DEFAULT] );
This is the main method which transforms a `JSON grammar` into a `CodeMirror` syntax-highlight parser.
`DEFAULT` is the default return value (`null` by default) for things that are skipped or not styled
In general there is no need to set this value, unless you need to return something else



__Parser Class__: `Parser`

```javascript
Parser = CodeMirrorGrammar.Parser;
```

The Parser Class used to instantiate a highlight parser, is available.
The `getMode` method will instantiate this parser class, which can be overriden/extended if needed, as needed.
In general there is no need to override/extend the parser, unless you definately need to.

Loading

0 comments on commit 5d9bea9

Please sign in to comment.