Skip to content

Commit

Permalink
v.4.1.0 (changes)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikos M committed Nov 27, 2016
1 parent f003258 commit 9845913
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions build/codemirror_grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4153,7 +4153,7 @@ var Parser = Class({
{
stream.start = token.space[0];
stream.pos = token.space[1];
token.space = null;
type = false; token.space = null;
}
else
{
Expand All @@ -4174,8 +4174,8 @@ var Parser = Class({
T[$value$] = stream.cur( 1 );
if ( false !== type )
{
type = Style[type] || DEFAULT;
T[$name$] = tokenizer.name;
type = type ? (Style[type] || DEFAULT) : DEFAULT;
T[$name$] = tokenizer ? tokenizer.name : null;
}
else if ( err )
{
Expand Down
2 changes: 1 addition & 1 deletion build/codemirror_grammar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion editor-grammar
Submodule editor-grammar updated 1 files
+3 −3 src/parser.js
8 changes: 8 additions & 0 deletions test/grammar-htmlmixed.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ <h3>CodeMirror (v.<span id="editor-version">0</span>) Grammar (v.<span id="gramm
comment */
foo2: 123
};
&lt;/script&gt;
&lt;script&gt;
/* this is also javascript content */
var bar = "foo";
&lt;/script&gt;
&lt;script type="application/x-something"&gt;
/* this is text by default */
var bar = "foo";
&lt;/script&gt;
&lt;/head&gt;
&lt;body id="id1"&gt;
Expand Down
Binary file modified test/grammar-htmlmixed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions test/grammars/htmlmixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ var htmlmixed_grammar = {
,"cdata:block" : ["<![CDATA[", "]]>"]
,"open_tag" : "RE::/<([_a-zA-Z][_a-zA-Z0-9\\-]*)/"
,"close_tag" : "RE::/<\\/([_a-zA-Z][_a-zA-Z0-9\\-]*)>/"
,"open_script_tag" : "RE::/<(script)/"
,"open_style_tag" : "RE::/<(style)/"
,"open_script_tag" : "RE::/<(script)\\b/"
,"open_style_tag" : "RE::/<(style)\\b/"
,"close_script_tag" : "RE::/<\\/(script)>/"
,"close_style_tag" : "RE::/<\\/(style)>/"
,"attribute" : "RE::/[_a-zA-Z][_a-zA-Z0-9\\-]*/"
,"string:line-block" : [["\""], ["'"]]
,"number" : ["RE::/[0-9]\\d*/", "RE::/#[0-9a-fA-F]+/"]
,"atom" : ["RE::/&#x[a-fA-F\\d]+;/", "RE::/&#[\\d]+;/", "RE::/&[a-zA-Z][a-zA-Z0-9]*;/"]
,"type_att" : "RE::/type\\b/"
,"text" : "RE::/[^<&]+/"

// actions
Expand All @@ -63,11 +64,12 @@ var htmlmixed_grammar = {
// Syntax model (optional)
"Syntax" : {

"javascript" : {"subgrammar":"javascript"}
"otherscript" : {"subgrammar":"otherscript"}
,"javascript" : {"subgrammar":"javascript"}
,"css" : {"subgrammar":"css"}
,"tag_att" : "'id'.attribute unique_att '=' string unique_id | attribute unique_att '=' (string | number)"
,"style_tag" : "(open_style_tag.tag tag_ctx tag_opened tag_att* '>'.tag \\tag_ctx) css close_style_tag.tag tag_closed"
,"script_tag" : "(open_script_tag.tag tag_ctx tag_opened tag_att* '>'.tag \\tag_ctx) javascript close_script_tag.tag tag_closed"
,"script_tag" : "open_script_tag.tag tag_ctx tag_opened (type_att! tag_att)* (type_att.attribute unique_att '=' ('\"text/javascript\"'.string (type_att! tag_att)*'>'.tag \\tag_ctx javascript | string (type_att! tag_att)* '>'.tag \\tag_ctx otherscript) close_script_tag.tag tag_closed | '>'.tag \\tag_ctx javascript close_script_tag.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"
,"htmlmixed" : "(^^1 declaration? doctype?) (declaration.error out_of_place | doctype.error out_of_place | comment | meta | cdata | style_tag | script_tag | start_tag | end_tag | atom | text)*"
Expand Down

0 comments on commit 9845913

Please sign in to comment.