MCPcopy Create free account
hub / github.com/TruthHun/BookStack / tokenBase

Function tokenBase

static/editor.md/lib/codemirror/mode/fortran/fortran.js:117–153  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

115 var litOperator = new RegExp("(\.and\.|\.or\.|\.eq\.|\.lt\.|\.le\.|\.gt\.|\.ge\.|\.ne\.|\.not\.|\.eqv\.|\.neqv\.)", "i");
116
117 function tokenBase(stream, state) {
118
119 if (stream.match(litOperator)){
120 return 'operator';
121 }
122
123 var ch = stream.next();
124 if (ch == "!") {
125 stream.skipToEnd();
126 return "comment";
127 }
128 if (ch == '"' || ch == "'") {
129 state.tokenize = tokenString(ch);
130 return state.tokenize(stream, state);
131 }
132 if (/[\[\]\(\),]/.test(ch)) {
133 return null;
134 }
135 if (/\d/.test(ch)) {
136 stream.eatWhile(/[\w\.]/);
137 return "number";
138 }
139 if (isOperatorChar.test(ch)) {
140 stream.eatWhile(isOperatorChar);
141 return "operator";
142 }
143 stream.eatWhile(/[\w\$_]/);
144 var word = stream.current().toLowerCase();
145
146 if (keywords.hasOwnProperty(word)){
147 return 'keyword';
148 }
149 if (builtins.hasOwnProperty(word) || dataTypes.hasOwnProperty(word)) {
150 return 'builtin';
151 }
152 return "variable";
153 }
154
155 function tokenString(quote) {
156 return function(stream, state) {

Callers

nothing calls this directly

Calls 1

tokenStringFunction · 0.70

Tested by

no test coverage detected