物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
1.1 KiB

const i={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,r){if(!r.inString&&(t.peek()=='"'||t.peek()=="'")&&(r.stringType=t.peek(),t.next(),r.inString=!0),t.sol()&&r.inArray===0&&(r.lhs=!0),r.inString){for(;r.inString&&!t.eol();)t.peek()===r.stringType?(t.next(),r.inString=!1):t.peek()==="\\"?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return r.lhs?"property":"string"}else{if(r.inArray&&t.peek()==="]")return t.next(),r.inArray--,"bracket";if(r.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(r.lhs&&t.eatWhile(function(e){return e!="="&&e!=" "}))return"property";if(r.lhs&&t.peek()==="=")return t.next(),r.lhs=!1,null;if(!r.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/)||!r.lhs&&(t.match("true")||t.match("false")))return"atom";if(!r.lhs&&t.peek()==="[")return r.inArray++,t.next(),"bracket";if(!r.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}};export{i as toml};