// Matches one whole word -- even if the word is a character
varword;
if (stream.match(/[%&;\w]+/,false)!=null){
word=ch+stream.match(/[%&;\w]+/,true);
if (/&/.test(word)){
return'variable'
}
}
else{
word=ch;
}
// the word after DATA PROC or MACRO
if (state.nextword){
stream.match(/[\w]+/);
// match memname.libname
if (stream.peek()==='.'){
stream.skipTo('');
}
state.nextword=false;
return'variable-2';
}
// Are we in a DATA Step?
if (state.inDataStep){
if (word.toLowerCase()==='run;'||stream.match(/run\s;/)){
state.inDataStep=false;
return'builtin';
}
// variable formats
if ((word)&&stream.next()==='.'){
//either a format or libname.memname
if (/\w/.test(stream.peek())){
//libname.memname
return'variable-2';
}
else{
//format
return'variable';
}
}
// do we have a DATA Step keyword
if (word&&words.hasOwnProperty(word.toLowerCase())&&(words[word.toLowerCase()].state.indexOf("inDataStep")!==-1||words[word.toLowerCase()].state.indexOf("ALL")!==-1)){
//backup to the start of the word
if (stream.start<stream.pos){
stream.backUp(stream.pos-stream.start);
}
//advance the length of the word and return
for (vari=0;i<word.length;++i){
stream.next();
}
returnwords[word.toLowerCase()].style;
}
}
// Are we in an Proc statement?
if (state.inProc){
if (word.toLowerCase()==='run;'||word.toLowerCase()==='quit;'){
state.inProc=false;
return'builtin';
}
// do we have a proc keyword
if (word&&words.hasOwnProperty(word.toLowerCase())&&(words[word.toLowerCase()].state.indexOf("inProc")!==-1||words[word.toLowerCase()].state.indexOf("ALL")!==-1)){
stream.match(/[\w]+/);
returnwords[word].style;
}
}
// Are we in a Macro statement?
if (state.inMacro){
if (word.toLowerCase()==='%mend'){
if (stream.peek()===';'){
stream.next();
}
state.inMacro=false;
return'builtin';
}
if (word&&words.hasOwnProperty(word.toLowerCase())&&(words[word.toLowerCase()].state.indexOf("inMacro")!==-1||words[word.toLowerCase()].state.indexOf("ALL")!==-1)){