(stream,state)
| 64 | ]; |
| 65 | |
| 66 | function basicToken(stream,state){ |
| 67 | var cur = ''; |
| 68 | var ch = ''; |
| 69 | ch = stream.next(); |
| 70 | // comment |
| 71 | if(ch == ";") { |
| 72 | stream.skipToEnd(); |
| 73 | return "comment"; |
| 74 | } |
| 75 | // context |
| 76 | if(ch == '[') { |
| 77 | stream.skipTo(']'); |
| 78 | stream.eat(']'); |
| 79 | return "header"; |
| 80 | } |
| 81 | // string |
| 82 | if(ch == '"') { |
| 83 | stream.skipTo('"'); |
| 84 | return "string"; |
| 85 | } |
| 86 | if(ch == "'") { |
| 87 | stream.skipTo("'"); |
| 88 | return "string-2"; |
| 89 | } |
| 90 | // dialplan commands |
| 91 | if(ch == '#') { |
| 92 | stream.eatWhile(/\w/); |
| 93 | cur = stream.current(); |
| 94 | if(dpcmd.indexOf(cur) !== -1) { |
| 95 | stream.skipToEnd(); |
| 96 | return "strong"; |
| 97 | } |
| 98 | } |
| 99 | // application args |
| 100 | if(ch == '$'){ |
| 101 | var ch1 = stream.peek(); |
| 102 | if(ch1 == '{'){ |
| 103 | stream.skipTo('}'); |
| 104 | stream.eat('}'); |
| 105 | return "variable-3"; |
| 106 | } |
| 107 | } |
| 108 | // extension |
| 109 | stream.eatWhile(/\w/); |
| 110 | cur = stream.current(); |
| 111 | if(atoms.indexOf(cur) !== -1) { |
| 112 | state.extenStart = true; |
| 113 | switch(cur) { |
| 114 | case 'same': state.extenSame = true; break; |
| 115 | case 'include': |
| 116 | case 'switch': |
| 117 | case 'ignorepat': |
| 118 | state.extenInclude = true;break; |
| 119 | default:break; |
| 120 | } |
| 121 | return "atom"; |
| 122 | } |
| 123 | } |