MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / normal

Function normal

mini-code-edit/cm/mode/lua/lua.js:64–85  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

62 }
63
64 function normal(stream, state) {
65 var ch = stream.next();
66 if (ch == "-" && stream.eat("-")) {
67 if (stream.eat("["))
68 return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
69 stream.skipToEnd();
70 return "comment";
71 }
72 if (ch == "\"" || ch == "'")
73 return (state.cur = string(ch))(stream, state);
74 if (ch == "[" && /[\[=]/.test(stream.peek()))
75 return (state.cur = bracketed(readBracket(stream), "string"))(stream, state);
76 if (/\d/.test(ch)) {
77 stream.eatWhile(/[\w.%]/);
78 return "number";
79 }
80 if (/[\w_]/.test(ch)) {
81 stream.eatWhile(/[\w\\\-_.]/);
82 return "variable";
83 }
84 return null;
85 }
86
87 function bracketed(level, style) {
88 return function(stream, state) {

Callers

nothing calls this directly

Calls 3

bracketedFunction · 0.85
readBracketFunction · 0.85
stringFunction · 0.85

Tested by

no test coverage detected