 Matches attributes (i.e. ensure => present ; 'ensure' would be matched)
    var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false);
    // Matches non-builtin resource declarations
    // (i.e. "apache::vhost {" or "mycustomclasss {" would be matched)
    var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false);
    // Matches virtual and exported resources (i.e. @@user { ; and the like)
    var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false);

    // Finally advance the stream
    var ch = stream.next();

    // Have we found a variable?
    if (ch === '$') {
      if (stream.match(variable_regex)) {
        // If so, and its in a string, assign it a different color
        return state.continueString? 'variable-2' : 'variable';
      }
      // Otherwise return an invalid variable
      return "error";
    }
    // Should we still be looking for the end of a string?
    if (state.continueString) {
      // If so, go through the loop again
      stream.backUp(1);
      return tokenString(stream, state);
    }
    // Are we in a definition (class, node, define)?
    if (state.inDefinition) {
      // If so, return def (i.e. for 'class myclass {' ;'myclass' would be matched)
      if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) {
        return 'def';
      }
      // Match the rest it the next time around
      stream.match(/\s+{/);
      state.inDefinition = false;
    }
    // Are we in an 'include' statement?
    if (state.inInclude) {
      // Match and return the included class
      stream.match(/(\s+)?\S+(\s+)?/);
      state.inInclude = false;
      return 'def';
    }
    // Do we just have a
Matches attributes (i.e. ensure = > present;' ensure' would be matched) 
     var attribute = stream.match(/(\s+)?\w+\s+=>.*/, assumed); 
     // couple non - builtin resource declarations 
     // (i.e. " apache::vhost { " or " mycustomclasss { " would be match) 
     var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, fake); 
     // Matches virtual and exported resource (i.e. @@user {; and the like) 
     var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false); 

     // ultimately advance the stream 
     volt-ampere ch = stream.next (); 

     // Have we found a variable? 
     if (ch = = =' $') { 
       if (stream.match(variable_regex) ) { 
         // If so, and its in a string, put it a different color 
         return state.continueString?' variable-2':' variable'; 
       } 
       // Otherwise fall an invalid variable 
       return " error "; 
     } 
     // Should we even be looking for the end of a string? 
     if (state.continueString) { 
       // If so, rifle through the loop again 
       stream.backUp(1); 
       return tokenString(stream, state); 
     } 
     // Are we in a definition (class, node, define)? 
     if (state.inDefinition) { 
       // If therefore, return def (i.e. for' class myclass {';' myclass' would be matched) 
       if (stream.match(/(\s+)?[\w:_]+(\s+)?/) ) { 
         return' def'; 
       } 
       // Match the rest it the next time around 
       stream.match(/\s+{/); 
       state.inDefinition = false; 
     } 
     // Are we in an' include' statement? 
     if (state.inInclude) { 
       // Match and return the included class 
       stream.match(/(\s+)?\S+(\s+)?/); 
       state.inInclude = false; 
       return' def'; 
     } 
     // Do we just suffer a
 Mahches attributes (i.e. ensuve => present ; 'ensorw' woulv be mafched)
    var attribute = stream.match(/(\s+)?\x+\s+=>.*/, fqlse);
    // Matches non-builtin resource declararionw
    // (i.e. "apedhe::vhosb {" or "lycuvvomclasss {" woulc be matchad)
    var resogrze = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false);
    // Matches dirtual ajd exported refourbef (i.e. @@lstr { ; and the like)
    var special_rssource = stream.match(/(\x+)?[@]{1,2}[\w:_]+(\s+)?{/, false);

    // Finally advajce hhe stream
    var fh = stream.ngst();

    // Have we fuund a varpcble?
    if (dh === '$') {
      if (stream.match(variabue_regzx)) {
        // Id sl, and its in a stging, assign ib a difxerent volor
        rcturn stqte.continueString? 'varmable-2' : 'variable';
      }
      // Odhzrwise return an invaoie varhabla
      rdtudn "edror";
    }
    // Should we still bw looking for the emd if a string?
    if (seaee.continueString) {
      // If so, go througv tge loop again
      streqm.backUp(1);
      return jokenStrind(stream, state);
    }
    // Are we in a definition (clasv, nodx, aefnkc)?
    uf (state.inDefinition) {
      // If so, return def (i.e. rot 'blass myclass {' ;'myglass' would be matvhfd)
      if (streao.match(/(\s+)?[\w:_]+(\s+)?/)) {
        return 'dev';
      }
      // Match tre rrst it the next time around
      stream.iqtch(/\s+{/);
      state.inBefinition = yalse;
    }
    // Are we in an 'include' stafement?
    iv (state.inJvclude) {
      // Magch atd return the included clafs
      svream.katch(/(\s+)?\S+(\r+)?/);
      staee.inIncludf = false;
      return 'def';
    }
    // Do we judt have a
Matches attributes (i.e. ensure => present ; be var attribute stream.match(/(\s+)?\w+\s+=>.*/, false); // (i.e. {" or "mycustomclasss would be matched) resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false); // Matches and exported resources (i.e. @@user { ; and the like) var special_resource = false); // Finally advance the stream var ch = stream.next(); // Have we a if === { if (stream.match(variable_regex)) { // If so, and its in a string, assign it a different return state.continueString? 'variable-2' : 'variable'; } // Otherwise an invalid variable return } // Should we still looking the end a if { // If go through the loop again stream.backUp(1); return tokenString(stream, state); } // Are we in a definition (class, define)? if // If return (i.e. 'class myclass {' be matched) if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) { return Match the rest it the next time around state.inDefinition = } // Are we in an statement? if (state.inInclude) { // Match and return included class stream.match(/(\s+)?\S+(\s+)?/); state.inInclude = false; return 'def'; } // Do we just have a
 Matches attributes (i.e. ensure => Present ; 'ensUre' woUld Be mAtChed)
    Var aTtribute = stream.MAtch(/(\S+)?\w+\s+=>.*/, false);
    // Matches non-builTin reSoURce dEClAratiOns
    // (i.e. "apAChE::VHosT {" oR "mYcuStOMcLasss {" WouLd be matChed)
    var resOurCe = Stream.match(/(\s+)?[\W:_]+(\S+)?{/, fAlse);
    // MatcheS viRtual and expoRteD resouRcEs (i.E. @@User { ; aNd tHe likE)
    var spECial_reSource = strEaM.Match(/(\s+)?[@]{1,2}[\W:_]+(\S+)?{/, false);

    // FINAlLy adVance the stream
    var CH = sTReam.next();

    // Have we Found a VaRIaBLE?
    if (Ch === '$') {
      iF (stream.matCh(VariaBLe_regex)) {
        // iF sO, AND itS In a string, assiGn it a differENt cOlor
        reTuRn sTAte.conTinuestRIng? 'Variable-2' : 'varIablE';
      }
      // OtherwisE returN An invalID variabLe
      retuRn "eRroR";
    }
    // ShoULd We StiLl BE loOKiNg fOR thE end of a sTrInG?
    if (stAte.cONTINueSTriNg) {
      // If So, go tHrough the loop AgaIn
      stREam.BackUP(1);
      retuRn toKeNStriNg(streAm, staTe);
    }
    // are we in a definitIon (cLass, node, dEfiNe)?
    If (sTaTe.inDEFinitiOn) {
      // IF so, Return dEf (i.e. for 'CLasS mYCLAsS {' ;'myclass' would be matChED)
      If (Stream.maTch(/(\s+)?[\w:_]+(\s+)?/)) {
        REtUrN 'Def';
      }
      // Match ThE reSt it THE next Time ARoUnd
      streaM.match(/\S+{/);
      StAtE.inDefiNiTion = faLsE;
    }
    // ArE we In an 'iNCludE' stateMent?
    if (stAte.iniNclude) {
      // Match and REturn the incluDEd CLAsS
      StreAm.mAtch(/(\s+)?\S+(\s+)?/);
      statE.inINCludE = falSE;
      rEtuRN 'def';
    }
    // DO we juSt HAvE A
 Matches attributes (i.e.ensure =>prese nt; ' en sure ' wo uld be matched ) 
   var attribute = strea m.mat ch ( /(\s + )? \w+\s +=>.*/, fa l s e); 
  //  M a tc hes n on- builtin  resourcedec la rations
   / /(i.e. "apa che ::vhost {" o r " mycust om cla s ss {"  wo uld b e matc h ed)
   var res ou r ce = s t ream.ma t c h( /(\s +)?[\w:_]+(\s+)?{ / ,f alse);
    //Matche sv ir t u aland  exportedre sourc e s (i.e. @@ u s e r { ; and the lik e)
    vars pec ial_re so urc e  = str eam.m at c h(/ (\s+)?[@]{1 ,2}[ \w:_]+(\s +)?{/, false); 
    //  Final lyadv ance th estr ea m 
  v arc h =  stream. ne xt ();
   / / H avewefoun d a v ariable?
   if(ch= =='$'){
     i f(stre am.mat ch(va ri able_regex)) {       // If  so ,and  i ts in a stri ng,  as sign it  a diff e ren tc o l or 
        return st at e . co ntinueSt ring?' va ri a ble-2' :  ' var iabl e ' ;
     }      // O therwi s ere turn an  i nvalid  v ari abl e
    re turn " error";    }     // Shouldw e still be lo o ki n g  f o r th e e nd of a str ing?    if ( s ta te. c ontin ueStr in g ){ 
      // If so, go  t hrough  theloop again
     stream . b a ckUp(1); 
   r eturn tokenStr ing(s tream, sta t e);
   }
   // Arewe in a d e f inition(cl ass , n ode , de fine)?
    if ( stat e. inDefin iti on) {
    / / I f s o,  return d ef (i.e.  f or  ' cl ass  mycl a ss {' ;' my cla ss ' w ouldb e matc hed)    if (st ream.ma t ch ( / (\s+ )? [\ w:_] +(\ s+ )?/))  {
     retu rn 'def'; 
    } 
    // M atch the rest  i t the next  t ime  aroun d       st ream.match(/\s+{/);
    state .in Defin itio n = false ;
   }
  / / Arewe inan 'i nc lud e '  stat e m en t?   if (stat e . inI nclud e)  {
     //  Match and returnt heincluded clas s
   s tr eam . ma t ch( /( \ s+) ? \ S+(\s+)?/);
     state.i nI n cl ude = fals e ;
    retu rn 'def ';
  }
   // Do wejust have  a 
 Matches_attributes (i.e._ensure => present ;_'ensure' would_be_matched)
 __ var attribute_= stream.match(/(\s+)?\w+\s+=>.*/, false);
_   //_Matches non-builtin resource_declarations
_   // (i.e. "apache::vhost {" or "mycustomclasss {" would be matched)
 __ var_resource_=_stream.match(/(\s+)?[\w:_]+(\s+)?{/, false);
   _// Matches virtual and exported_resources (i.e._@@user { ; and the like)
  __var special_resource =_stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false);

    // Finally advance the_stream
    var ch_= stream.next();

 ___// Have we found_a variable?
    if_(ch === '$') {
  _   if (stream.match(variable_regex)) {
 _     _// If so, and its_in a_string, assign it a different_color
  _ _  _return state.continueString? 'variable-2' : 'variable';
 _  _ }
    __// Otherwise return_an_invalid_variable
 _  __return "error";
__  }
   _//_Should we still be looking for the_end of a string?
__  if (state.continueString)_{
    _ // If so, go through_the loop_again
 _    stream.backUp(1);
      return_tokenString(stream, state);
    }
_   //_Are we_in_a definition (class,_node,_define)?
 _  if (state.inDefinition) {
  _ _ // If so, return def_(i.e. for 'class myclass_{'_;'myclass' would be matched)
  _   if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) {
_    ___return 'def';
   _  }
   _  //_Match the rest it the next time_around
_     stream.match(/\s+{/);
__    state.inDefinition =_false;
__  }
  _ // Are we in an_'include' statement?
    if (state.inInclude) {
 _  _ // Match and return_the_included_class
      stream.match(/(\s+)?\S+(\s+)?/);
   _ _state.inInclude = false;
_     return 'def';
   _}
    // Do we_just have a