home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / con2v766.zip / colore01.zip / includes / scripts / lexyacc.hrc < prev    next >
Text File  |  2000-03-05  |  7KB  |  162 lines

  1. <!--
  2.    Lex(flex) & YACC(Bison) Files Syntax
  3.    Made by Timur Safin <timur@lanit.ru>
  4. -->
  5.  
  6. <Define Name="LYText"      Value="dDefText">
  7. <Define Name="LYString"    Value="dStrings">
  8. <Define Name="LYComment"   Value="dComments">
  9. <Define Name="LYCommentEx" Value="dCommentsEx">
  10. <Define Name="LYSymb"      Value="dResWords">
  11. <Define Name="LYSymbEx"    Value="dDirectives">
  12. <Define Name="LYSymbEx0"   Value="dStringsEx">
  13. <!--Define Name="LYYaccName"  Value="dDefText"-->
  14. <Define Name="LYYaccName"  Value="dCommentsEx">
  15.  
  16. <include name="includes/baselng/c.hrc">
  17.  
  18. <Scheme Name="mLYComments">
  19.    <RegExp Start="/(\/\/.*$)/" Color0="LYComment">
  20.    <Block  Start="/\/\*/" End="/\*\//" Scheme="Comment" Color0="LYComment">
  21. </Scheme>
  22.  
  23. <!-- flex stuff -->
  24. <Scheme Name="LYOptionText">
  25.     <Include Scheme="mLYComments">
  26.     <RegExp Start='/("((\\.)|[^\\"])*?")/' Color0="LYString">
  27. </Scheme>
  28.  
  29. <Scheme Name="LexSymbols">
  30.     <RegExp Start="/(\{(\w+)\})/" Color0="LYSymb" Color1="LYSymbEx">
  31.  
  32.     <!-- POSIX char-classes -->
  33.     <KeyWords Color="LYSymb">
  34.        <Symb Name="[:alnum:]"><Symb Name="[:alpha:]"><Symb Name="[:blank:]">
  35.        <Symb Name="[:cntrl:]"><Symb Name="[:digit:]"><Symb Name="[:graph:]">
  36.        <Symb Name="[:lower:]"><Symb Name="[:print:]"><Symb Name="[:punct:]">
  37.        <Symb Name="[:space:]"><Symb Name="[:upper:]"><Symb Name="[:xdigit:]">
  38.     </KeyWords>
  39.  
  40.     <!-- other flex regexp symbols -->
  41.     <KeyWords Color="LYSymb">
  42.        <Symb Name=".">
  43.        <Symb Name="["><Symb Name="]">
  44.        <Symb Name="-"><Symb Name="+">
  45.        <Symb Name="*"><Symb Name="?">
  46.        <!--Symb Name="{"><Symb Name="}"-->
  47.        <Symb Name="("><Symb Name=")">
  48.        <Symb Name="\"><Symb Name="/">
  49.        <Symb Name="|"><Symb Name="^"><Symb Name="$">
  50.        <Symb Name="<<EOF>>">
  51.     </KeyWords>
  52. </Scheme>
  53.  
  54. <Scheme Name="mLYLexC">
  55.     <Include Scheme="C">
  56.     <KeyWords MatchCase="True" Color="LYSymbEx">
  57.         <Word Name="BEGIN">
  58.         <Word Name="ECHO">
  59.     </KeyWords>
  60. </Scheme>
  61.  
  62. <Scheme Name="LYCompoundCLex">
  63.     <Block  Start="/(\{)/" End="/(\})/" Scheme="LYCompoundCLex" Color1="LYSymb" Color2="LYSymb">
  64.     <Include Scheme="mLYLexC">
  65. </Scheme>
  66.  
  67. <Scheme Name="LYLexRule">
  68.     <Include Scheme="mLYComments">
  69.     <Include Scheme="mCString">
  70.     <!--Block  Start="/(\s+\{)/" End="/(\})/" Scheme="LYCompoundCLex" Color0="LYCommentEx" Color1="LYSymbEx" Color2="LYSymbEx"-->
  71.     <Block  Start="/(\s+\{)/" End="/(\})/" Scheme="LYCompoundCLex" Color1="LYSymbEx" Color2="LYSymbEx">
  72.     <Include Scheme="LexSymbols">
  73.     <Block  Start="/\s+/" End="/$/" Scheme="mLYLexC" Color0="LYCommentEx">
  74. </Scheme>
  75.  
  76. <Scheme Name="LYLexStateRules">
  77.     <Include Scheme="mLYComments">
  78.     <Block Start="/^\s+/" End="/$/" Scheme="LYLexRule">
  79. </Scheme>
  80.  
  81. <!-- Bison stuff -->
  82. <Scheme Name="LYCompoundC">
  83.     <RegExp Start="/\c(\$[\$\d]{,2})/" Color0="LYSymbEx">
  84.     <Block  Start="/(\{)/" End="/(\})/" Scheme="LYCompoundC" Color1="LYSymb" Color2="LYSymb">
  85.     <Include Scheme="C">
  86. </Scheme>
  87.  
  88. <Scheme Name="LYYaccRule">
  89.     <Include Scheme="mLYComments">
  90.     <RegExp Start="/('..??.??.??')/" Color0="LYString">
  91.     <RegExp Start="/\b ([a-zA-Z\d\.\_]+) \B|$/x" Color0="LYYaccName">
  92.     <RegExp Start="/(\%prec)\s+([\w\.\_]+)/" Color0="LYSymb" Color0="LYSymbEx">
  93.     <Block  Start="/(\{)/" End="/(\})/" Scheme="LYCompoundC" Color1="LYSymbEx" Color2="LYSymbEx">
  94.  
  95.     <KeyWords Color="LYSymbEx">
  96.        <Symb Name=":">
  97.        <Symb Name="|">
  98.     </KeyWords>
  99. </Scheme>
  100.  
  101. <Scheme Name="LYSecondPart">
  102.     <Include Scheme="mLYComments">
  103.     <Block  Start="/\s+/" End="/$/" Scheme="C">
  104.     <!--  Last (third) C part.
  105.     TODO! What about Delphi Yacc/Lex ? They should embed Pascal-blocks
  106.           instead of C. How we could to recognise it ?... -->
  107.     <Block   Start="/^(\%\%)/" End="/^NeVeRUseD$/" Scheme="C" Color1="dResWords">
  108.     <!-- embedded C-block -->
  109.     <Block   Start="/^(\%\{)/" End="/(\%\})/"  Scheme="C" Color1="LYSymb" Color2="LYSymb">
  110.     <!-- LEX regexp at the start of line -->
  111.     <Block   Start='/^([\{\[\\\"\(\d]|(\.\s+))?=/' End="/$/" Scheme="LYLexRule">
  112.     <!-- Yacc rule -->
  113.     <Block   Start="/(^[\w\.\_]+\s*\:?)?=/" End="/(;)/" Scheme="LYYaccRule" Color2="LYSymbEx">
  114.     <!-- Mostly Buggy grammar may contain YACC-rules without left non-terminal.
  115.          See SWIG's parser.y for example -->
  116.     <Block   Start="/(^\s+\|)?=/" End="/(;)/" Scheme="LYYaccRule" Color2="LYSymbEx">
  117.     <!-- lex compound conditional state -->
  118.     <Block   Start="/^(\<[\w,\s\*]+\>)(\{)$/" End="/^(\})/" Scheme="LYLexStateRules"
  119.              Color1="LYSymbEx" Color2="LYSymbEx0" Color3="LYSymbEx0">
  120.     <!-- lex single line rule prepended by conditional state -->
  121.     <Block   Start="/^(\<[\w,\s\*]+\>)/" End="/$/" Scheme="LYLexRule" Color1="LYSymbEx">
  122.     <!-- LEX regexp at the start of line #2 -->
  123.     <Block   Start='/^(\S+[\?\-\+\*\{\[\\\"\(])?=/' End="/$/" Scheme="LYLexRule">
  124.     <!-- C-block for lex rule -->
  125.     <Block   Start="/(\{)$/" End="/(\})/" Scheme="LYLexStateRules"
  126.              Color1="LYSymbEx" Color2="LYSymbEx">
  127.     <!--Block   Start="/(^[\w\.\_]+)?=/" End="/(;)/" Scheme="LYYaccRule" Color2="LYSymbEx"-->
  128. </Scheme>
  129.  
  130. <Scheme Name="LYPerCent">
  131.     <Include Scheme="mLYComments">
  132.     <RegExp Start="/('..??.??.??')/" Color0="LYString">
  133.     <Block   Start="/(option)/" End="/$/" Color1="LYSymb" Scheme="LYOptionText">
  134.     <!-- Timur: It's mine...-->
  135.     <RegExp  Start="/\b (start-condition) \B/x" Color0="LYSymb">
  136.     <!-- YACC/Bison -->
  137.     <RegExp  Start="/\b ((token)|(left)|(right)|(nonassoc)|(start)|(no_lines)|(pure_parser)|(type)|(expect)|(raw)|(token_table)) \B/x" Color0="LYSymb">
  138.     <!-- LEX/flex -->
  139.     <RegExp  Start="/\b ([xsaceknopr]|(pointer)|(array)) \B/x" Color0="LYSymb">
  140.     <!-- flex++ -->
  141.     <RegExp  Start="/\b ((name)|(define)) \B/x" Color0="LYSymb">
  142. </Scheme>
  143.  
  144. <Scheme Name="LexYacc">
  145.     <Include Scheme="mLYComments">
  146.     <!-- embedded  C block -->
  147.     <Block   Start="/^(\%\{)/" End="/(\%\})/"  Scheme="C" Color1="LYSymb" Color2="LYSymb">
  148.     <!-- Timur's extensions -->
  149.     <Block   Start="/^(\%(lex)|(syntax)\{)/" End="/(\%\})/"  Scheme="C" Color1="LYSymb" Color4="LYSymb">
  150.     <!-- flex++ specific -->
  151.     <Block   Start="/^(\%header\{)/" End="/(\%\})/"  Scheme="C" Color1="LYSymb" Color2="LYSymb">
  152.  
  153.     <!-- start second part -->
  154.     <Block   Start="/^(\%\%)/" End="/^NeVeRUseD$/" Scheme="LYSecondPart" Color1="LYSymb">
  155.  
  156.     <!-- other Lex/Yacc directives -->
  157.     <Block   Start="/^(\%union\s*\{)/" End="/(\})/" Scheme="C" Color1="LYSymb" Color2="LYSymb">
  158.     <Block   Start="/^(\%)/" End="/\M^%|\S/" Scheme="LYPerCent" Color0="LYCommentEx" Color1="LYSymb">
  159.  
  160.     <!-- flex macro definitions -->
  161.     <Block   Start="/^(\w+)(\s+)?=/" End="/$/" Scheme="LexSymbols" Color0="LYString" Color1="LYText">
  162. </Scheme>