Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit d4b6c29

Browse files
reduced the number of tokens generated by YAML mode by coallescing tokens
1 parent 2ba17e1 commit d4b6c29

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lang-yaml.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
PR.registerLangHandler(
1111
PR.createSimpleLexer(
1212
[
13-
[PR.PR_PUNCTUATION, /^[:|>?]/, null, ':|>?'],
13+
[PR.PR_PUNCTUATION, /^[:|>?]+/, null, ':|>?'],
1414
[PR.PR_DECLARATION, /^%(?:YAML|TAG)[^#\r\n]+/, null, '%'],
1515
[PR.PR_TYPE, /^[&]\S+/, null, '&'],
1616
[PR.PR_TYPE, /^!\S*/, null, '!'],
1717
[PR.PR_STRING, /^"(?:[^\\"]|\\.)*(?:"|$)/, null, '"'],
1818
[PR.PR_STRING, /^'(?:[^']|'')*(?:'|$)/, null, "'"],
19-
[PR.PR_COMMENT, /^#[^\r\n]*/, null, '#']
19+
[PR.PR_COMMENT, /^#[^\r\n]*/, null, '#'],
20+
[PR.PR_PLAIN, /^\s+/, null, ' \t\r\n']
2021
],
2122
[
2223
[PR.PR_DECLARATION, /^(?:---|\.\.\.)(?:[\r\n]|$)/],
2324
[PR.PR_PUNCTUATION, /^-/],
24-
[PR.PR_KEYWORD, /^\w+:[ \r\n]/]
25+
[PR.PR_KEYWORD, /^\w+:[ \r\n]/],
26+
[PR.PR_PLAIN, /^\w+/]
2527
]), ['yaml', 'yml']);

0 commit comments

Comments
 (0)