# Syntax patterns for LE editor. (c) 1997 Alexander V. Lukyanov
# Please send corrections and improvements to <lav@yars.free.net>
#
# $Id: syntax,v 1.21 2002/08/06 12:52:26 lav Exp $
#
# This file describes how to highlight syntax. The following format
# used:
# /PATTERN - selects file names for which next lines apply
# c[i]COLOR,MASK=REGEXP - use COLOR (1-3) to highlight subexpressions
# of REGEXP; MASK is bitmask selecting which subexpressions are to
# highlight. C escapes can be used in REGEXP; it also can be split
# into several lines by last \ on the line. The optional `i' means
# to ignore case.

# c3 usually marks comments or text strings
# c2 usually marks important syntax elements
# c1 usually marks keywords

# maximum height of constructs
h18

# C language mode (lav)
/*.c|/-\*- *c *-\*-
c3,1="([^"\n\\]|\\\\(.|\n))*"|'([^'\n\\]|\\\\.)*'
#c3,1=^[ \t]*#([^\\\n]|\\\\(.|\n))*$
c3,2=^[ \t]*(#[ \t]*(include[ \t]*<[^>\n]*>|[[:alpha:]]*))
c3,1=/\\*([^*]|\\*[^/])*\\*/
c1,4=([^[:alnum:]_]|^)(asm|else|if|switch|case|while|for|goto|break\
|continue|char|short|int|long|unsigned|signed|auto\
|const|default|do|double|enum|extern|float|register\
|return|sizeof|static|struct|typedef|union|void|volatile\
)([^[:alnum:]_]|$)
c2,1=\\[|\\]|\\(|\\)|{|}|,

# C++ mode (lav)
/*.cc|*.C|*.cpp|*.h|*.hh|*.hpp|*.H|/-\*- *c++ *-\*-
c3,1="([^"\n\\]|\\\\(.|\n))*"|'([^\n'\\]|\\\\.)*'
#c3,1=^[ \t]*#([^\\\n]|\\\\(.|\n))*$
c3,2=^[ \t]*(#[ \t]*(include[ \t]*<[^>\n]*>|[[:alpha:]]*))
c3,1=//.*$|/\\*([^*]|\\*[^/])*\\*/
c1,4=([^[:alnum:]_]|^)(asm|else|if|switch|case|while|for|goto|break\
|continue|char|short|int|long|unsigned|signed|auto\
|const|default|do|double|enum|extern|float|register\
|return|sizeof|static|struct|typedef|union|void|volatile\
|try|catch|class|new|delete|private|public|protected|this|virtual\
|inline|bool|true|false|operator|overload|template|friend|namespace|using\
|typeid|dynamic_cast\
)([^[:alnum:]_]|$)
c2,1=\\[|\\]|\\(|\\)|{|}|,

# nroff mode (lav)
/*.[1-9]|/-\*- *nroff *-\*-
c3,1=^\.\\\\".*$
c2,1=^\.[[:alpha:]]*
c1,2=\\\\fB((\\\\[^f]|[^\\])*[^\\]?)(\\\\f|$)
c3,2=\\\\fI((\\\\[^f]|[^\\])*[^\\]?)(\\\\f|$)
c1,2=^\.B[IR]? (.*)$
c3,2=^\.I (.*)$

# Eiffel mode, by Serge Vakulenko <vak@cronyx.ru>
/*.e
c3,1=--[^\n]*\n
c3,1="([^"\\]|\\\\(.|\n))*"
c1,4=([^[:alnum:]_]|^)(alias|all|and|as|check|class|creation|debug\
|deferred|do|else|elseif|end|ensure|expanded|export|external|false\
|feature|from|frozen|if|implies|indexing|infix|inherit|inspect|invariant\
|is|like|local|loop|not|obsolete|old|once|or|prefix|redefine|rename\
|require|rescue|retry|select|separate|strip|then|true|undefine|unique\
|until|variant|when|xor|Current|Result|True|False|Void\
|ARRAY|BIT|BOOLEAN|CHARACTER|DOUBLE|INTEGER|NONE|POINTER|REAL|STRING\
)([^[:alnum:]_]|$)
c2,1=<<|>>

# Python mode, by Serge Vakulenko <vak@cronyx.ru>
/*.py
c3,1=#.*$
c3,1="([^"\\]|\\\\(.|\n))*"|'([^'\\]|\\\\(.|\n))*'
c1,4=([^[:alnum:]_]|^)(if|elif|else|for|in|break|continue|while|pass\
|try|except|raise|finally|import|from|class|def|return|global\
|print|del|exec|access|in|or|and|not|is|lambda\
)([^[:alnum:]_]|$)
c2,1=:

# Sather mode, by Serge Vakulenko <vak@cronyx.ru>
/*.sa
c3,1=--[^\n]*$
c3,1="([^"\\]|\\\\(.|\n))*"
c1,4=([^[:alnum:]_]|^)(abstract|and|any|assert|attr|bind|break!|builtin|case\
|class|clusters!|cohort|const|else|elsif|end|exception|external|false|far\
|fork|guard|if|immutable|inout|include|initial|is|ITER|lock|loop|near|new\
|once|or|out|par|parloop|post|pre|private|protect|quit|raise|readonly|result\
|return|ROUT|SAME|self|shared|sync|then|true|typecase|unlock|until|void|when\
|while!|with|yuild|ARRAY|BOOL|CHAR|FLTD|INT|INTI|FLT|FLTI|STR|\\$OB|AREF|AVAL\
|TUP|SYS|\\$NIL|\\$FINALIZE\
)([^[:alnum:]_]|$)
c2,1=\||#|::=|:=|::

# Shell mode, by Serge Vakulenko <vak@cronyx.ru>
/*.sh|/^#![ \t]*/.*/\(ba\|z\|k\)?sh\|-\*- *sh *-\*-
c3,1=#.*$
c3,2=[^\\]("([^"\\]|\\\\(.|\n))*"|'([^'\\]|\\\\(.|\n))*')
c1,4=([^[:alnum:]/_]|^)(if|then|else|elif|fi|while|do|done|for|break|continue\
|case|in|esac|local|return|exit|alias|bg|cd|eval|exec|export|fc|fg|getopts|hash\
|jobid|jobs|pwd|read|readonly|set|setvar|shift|trap|ulimit|umask|unalias|unset\
|wait\
)([^[:alnum:]/_]|$)
c2,1={|}|<<|<|>>|>|;;|;|\(|\)|\|

# java mode (bird@yars.free.net)
/*.java|/-\*- *java *-\*-
c3,1="([^"\n\\]|\\\\.)*"|'([^\n'\\]|\\\\.)*'
c3,1=//.*$|/\\*([^*]|\\*[^/])*\\*/
c1,4=([^[:alnum:]_]|^)(abstract|default|if|private|throw|boolean|do|implements\
|protected|throws|break|double|import|public|transient|byte|else|instanceof\
|return|try|case|extends|int|short|void|catch|final|interface|static|volatile\
|char|finally|long|super|while|class|float|native|switch|const|for|new\
|synchronized|continue|goto|package|this\
)([^[:alnum:]_]|$)
c2,1=\\[|\\]|\\(|\\)|{|}|,

# po (i18n) mode (lav)
/*.po
c1,1=^#, .*
c2,1="|\\\\n|%[+- #]*[0-9*]*\\.?[0-9*]*l?[l]?[diouxXfeEgGcs]
c3,1=^#.*$

# html mode (lav)
/*.html|*.htm|*.shtml|/-\*- *html *-\*-\|^<![Dd][Oo][Cc][Tt][Yy][Pp][Ee] [Hh][Tt][Mm][Ll]\|^<[Hh][Tt][Mm][Ll]>
c3,2=<!--(([^-]|-[^-]|--[^>])*)-->
c3,2=<!([a-zA-Z][^>]*)>
c3,2=("([^"\n\\]|\\\\.)*"|'([^\n'\\]|\\\\.)*')[^<]*>
c2,1=<!--|-->|<[/!]|<|>|&[a-zA-Z]+;|&#[0-9]+;
ci1,2=<[!/]?(HTML|BODY|TITLE|HEAD|META|STYLE|FRAME(SET)?|IFRAME|APPLET|\
BASE(FONT)?|NOFRAMES|A( HREF| NAME)?|IMG( SRC)?|AREA|(NO)?SCRIPT|OBJECT|\
PARAM|LINK|MAP|P( ALIGN)?|HR( WIDTH)?|PRE|BLOCKQUOTE|QUOTE|Q|DIV|CENTER|\
H[1-6]|BR|INS|DEL|BDO|SPAN|TT|[BIUS]|FONT( ALIGN| SIZE| COLOR)?|STRONG|\
SAMP|VAR|CODE|EM|ADDRESS|DFN|CITE|ABBR|ACRONYM|BIG|SMALL|BLINK|LISTING|\
KBD|STRIKE|SU[BP]|UL|OL|LI|DIR|MENU|DL( COMPACT)?|DT|DD|THEAD|TFOOT|TBODY|\
INPUT|FORM|SELECT|OPTION|BUTTON|FIELDSET|LABEL|LEGEND|OPTGROUP|TEXTAREA|\
ISINDEX|TABLE|TR|TD( WIDTH| VALIGN)?|TH|CAPTION|COL(GROUP)?|MULTICOL|\
(I|NO)?LAYER|ABOVE|BGSOUND|ARRAY|COMMENT|EMBED|FIG|MARQUEE|NEXTID|NOBR|\
RANGE|ROOT|SOUND|SPACER|SQRT|TEXT|WBR|XMP\
)[\n\r\t >=]

##########################################################################
# Lout mode by Abel Morabito <abelmora@crosswinds.net>
# extension .lout
# Most standard tags for Lout 3.24
/*.lout
#### COMMENTS AND LITERAL TEXT
c3,1=(#.*$)|("[^"]*")
## SPECIAL CHARACTERS
c2,1=(@|&|/|\^|{|}|\||~|"|\\\|``|'')
#### TAGS
c1,2=@(Abbreviations|AboveChapterGap|AbstractDisplay|AbstractFormat\
|AbstractTitle|AbstractWord|ACell|ACurve|ACurveArrow\
|Address|AfterTitlePage|AIndex|AL|AlignedDisplay|AlphaList\
|AmberLight|And|Annote|ANode|AnotherFootNote|AppendixGap\
|AppendixHeadingBreak|AppendixHeadingFont|AppendixHeadingFormat\
|AppendixInContents|AppendixNumbers|AppendixNumInDisplays\
|AppendixNumInFigures|AppendixNumInTables|AppendixNumInTheorems\
|AppendixPrefix|AppendixWord|Arrow|AtEnd|Author|AuthorIndex|B|BAD\
|BasicSetup|Batlow|BCell|BeforeTitlePage|Begin\
|BeginAlignedDisplays|BeginAppendices|BeginChapters\
|BeginOverheads|BeginSections|BeginSubAppendices\
|BeginSubSections|BeginSubSubAppendices|BeginSubSubSections\
|Bezier|BezierArrow|BI|BigOctagon|BIndex|BIsymbols|BL\
|Blue|BNode|Body|BookSetup|BoundaryMarks|Box|Break\
|Bullet|BulletList|BypassBeginIndex|BypassChapReference\
|BypassContentsEntry|BypassEndIndex|BypassMajorContentsEntry\
|BypassNumber|BypassRawIndex|BypassReference|Caption\
|CaptionBreak|CaptionFont|CaptionFormat|CaptionPos|Case|CC\
|CCell|CCurve|CCurveArrow|CD|CDot|Cell|CenteredDisplay\
|CenteredList|CentredAlignedNumberedDisplay|CentredDisplay\
|CentredList|ChapCite|ChapRef|ChapRefListTitle\
|ChapterHeadingBreak|ChapterHeadingFont|ChapterHeadingFontand\
|ChapterHeadingFormat|ChapterInContents|ChapterNumbers\
|ChapterNumInDisplays|ChapterNumInTheorems|ChapterStartPages\
|ChapterStartPagesdetermineswhat|ChapterWord|Char|Circle\
|Cite|CL|Claim|ClaimWord|ClosedCircle|CNode|CNP|Code\
|Color|Colour|ColumnGap|ColumnGapmay|ColumnNumber|Com\
|Conjecture|ContentsGap|ContentsGapAbove|ContentsGapBelow\
|ContentsGoesHere|ContentsGoesHeresymbol|ContentsLeader\
|ContentsLeaderGap|ContentsRightWidth|ContentsSeparate\
|ContentsWord|CopyRight|Corollary|CoverSheet|CP|CPSetup\
|CrossLink|CrossLinkFormat|CtdWord|CTR|CurveArrow|CurveBox\
|Dagger|DaggerDbl|DashJoin|DashList|Database|Date\
|DateLine|DayNum|DefaultIndent|Definition|Degree|Diag\
|DiagSetup|Diagsymbol|Diamond|Display|DisplayGap\
|DisplayIndent|DisplayNumStyleoption|Diverted|Divide|DL\
|DLI|Doc|Document|DocumentSetup|DotJoin|DotJoinbut\
|DotSep|DoubleArrow|DoubleLine|DP|DropCapThree|DropCapTwo\
|DropListItem|DropTagItem|DTI|DWrapArrow|DWrapCurve\
|DWrapCurveArrow|DWrapLine|Edition|Eiffel|EL|Ellipse|End\
|EndAlignedDisplays|EndAppendices|EndChapters|EndHeaderRow\
|EndList|EndNote|EndOverheads|EndProof|EndSections\
|EndSubAppendices|EndSubSections|EndSubSubAppendices\
|EndSubSubSections|Eq|Eqsymbol|Euro|EvenFoot\
|EvenLeftBodyMargin|EvenLeftMargin|EvenRightBodyMargin\
|EvenRightMargin|EvenTop|Example|Figure|FigureCaptionBreak\
|FigureCaptionFont|FigureCaptionFormat|FigureCaptionPos\
|FigureFormat|FigureListWord|FigureLocation|FigureNumbers\
|FigureWord|FirstAppendixNumber|FirstLectureNumber\
|FirstOverheadNumber|FirstPageNumber|FirstRow|FirstRowa\
|FirstRowb|FirstSub|Florin|Fmta|Font|FootAboveGap\
|FootGap|FootLen|FootMargin|FootNote|FootNoteBreak\
|FootNoteFont|FootNoteFormat|FootNoteLocation|FootNoteNumbers\
|FootNoteThrough|Format|FullPage|FullWidthRule\
|FullWidthsymbols|Graph|GraphCircle|GraphCross|GraphDashed\
|GraphDiamond|GraphDotted|GraphFilledCircle|GraphFilledDiamond\
|GraphFilledSquare|GraphFilledTriangle|GraphNoLine|GraphPlus\
|GraphSolid|GraphSquare|Graphsymbol|GraphTriangle|GreyBox\
|HeaderFirstRow|HeaderFirstRowa|HeaderFirstRowb|HeaderRow\
|HeaderRowa|HeaderRowb|HeaderRowd|HeaderRowh\
|HeaderRowhsymbol|Heading|HeadingBox|HeadingFont|HExpand\
|High|Hour|HowPublished|HShift|HSpan|HTree|HVArrow\
|HVCurve|HVCurveArrow|HVLine|I|ID|If|II|IL\
|Illustration|InAuthor|Include|IncludeGraphic\
|IndentedDisplay|IndentedList|Index|IndexA|IndexBBlanks\
|IndexBlanks|IndexBreak|IndexColumnGap|IndexColumnNumber\
|IndexCtd|IndexCtdFormat|IndexCtdWord|IndexFont|IndexWord\
|InitialBreak|InitialColour|InitialFont|InitialLanguage\
|InitialSpace|InnerNote|Insert|Institution|InTitle\
|Introduction|IntroEvenFoot|IntroEvenTop|IntroFirstPageNumber\
|IntroOddFoot|IntroOddTop|IntroPageNumbers|IntroStartEvenFoot\
|IntroStartEvenTop|IntroStartOddFoot|IntroStartOddTop\
|Isosceles|Isymbol|Journal|Keywords|Label|Labeloption\
|Language|LD|Lecture|LectureHeadingFont|LectureHeadingFormat\
|LectureInContents|LectureNumbers|LeftDisplay|LeftList\
|LeftNote|LeftSub|Lemma|LI|Line|Link|List|ListGap\
|ListIndent|ListInterruptItem|ListItem|ListNewPage\
|ListOuterGap|ListRightIndent|ListTagWidth|LLP\
|LocalWidthRule|Location|Loop|LoopDiverted|LoopOpposite\
|LOP|Lozenge|LP|LVRArrow|LVRCurve|LVRCurveArrow|LVRLine\
|MajorNum|MajorTitle|MakeContents|MakeFigureContents\
|MakeIndex|MakeReferences|MarginNoteBreak|MarginNoteFont\
|MarginNoteHGap|MarginNoteVGap|MarginNoteWidth|MarkRow\
|MarkRowa|MeriDiem|MinorNum|MinorTitle|Minute|Modula\
|MonthNum|Multiply|MyLink|MyNode|NCP|NE|NextSub|NL\
|NoBreakRow|NoBreakRowa|NoBreakRowb|NoChapCite|NoChapRef\
|NoCite|Node|NoDotJoin|NoDotSep|NoRef|Note|NP|Null\
|NumberedDisplay|NumberedList|NumberOf|NumberSeparator\
|NumSep|NW|OddFoot|OddLeftBodyMargin|OddLeftMargin\
|OddPageTop|OddRightBodyMargin|OddRightMargin|OddTop|OneCol\
|OnePage|OneRow|OnTitlePage|Open|OpenCircle|OptimizePages\
|Optional|OptionalDiverted|OrdinarySetup|Organization\
|OrIfPlain|OuterNote|Outline|Overhead|OverheadHeadingFont\
|OverheadHeadingFormat|OverheadInContents|OverheadNumbers\
|OverheadSetup|OverheadTransparencies|OverStrike\
|PageBackground|PageBox|PageBoxLineWidth|PageBoxMargin\
|PageBoxPaint|PageBoxShadow|PageBoxType|PageEnclose\
|PageHeaders|PageHeight|PageMark|PageNumbersand|PageOf\
|PageOrientation|PageOrientationsymbol|Pages|PageType\
|PageWidth|PAL|ParaGap|ParaIndent|ParenAlphaList\
|ParenNumberedList|ParenRomanList|ParenUCAlphaList\
|ParenUCRomanList|ParSym|PartHeadingFormat|PartNumber\
|PartText|PartTitle|Pas|Perl|Pinpoint|Place|PNL|Pod\
|Poetry|Polygon|PP|PPsymbol|Preface|PrefaceAfterContents\
|PRL|Proof|Proposition|Publisher|PUCAL|PUCRL|Python|QD\
|QL|QQ|QuotedDisplay|QuotedList|RawAlignedDisplay\
|RawAlignedNumberedDisplay|RawCentredAlignedNumberedDisplay\
|RawEndList|RawIndex|RawList|RawNumberedList\
|RawParenRomanList|RawSubIndex|RawSubSubIndex\
|RawVerbatimsymbol|RCAND|RefCiteLabels|RefCiteStyle\
|ReferencesBeforeAppendices|ReferencesInContents|RefListBreak\
|RefListFont|RefListFormat|RefListGap|RefListIndent\
|RefListLabels|RefListLabelWidth|RefListLabelWidthdetermines\
|RefListLabelWidthsetup|RefListRightIndent|RefListSortKey\
|RefListTitle|RefNum|RefNumbers|RefPrint|RefStyle|Register\
|Repeat|RepeatDiverted|RepeatOpposite|Report|ReportSetup\
|RightDisplay|RightNote|RightSub|RightSubsymbol|RL|RNL\
|RomanList|Rotate|Rowa|Rowb|Rowc|Rowd|RR\
|RunningEvenFoot|RunningEvenTop|RunningIntroEvenFoot\
|RunningIntroEvenTop|RunningIntroOddFoot|RunningIntroOddTop\
|RunningIntroStartEvenFoot|RunningIntroStartEvenTop\
|RunningIntroStartOddFoot|RunningIntroStartOddTop|RunningOddFoot\
|RunningOddTop|RunningStartEvenFoot|RunningStartEvenTop\
|RunningStartOddFoot|RunningStartOddTop|RunningTitle\
|RunningTitleoption|RVLArrow|RVLCurve|RVLCurveArrow|RVLLine\
|Scale|SE|Second|Section|SectionGap|SectionHeadingFont\
|SectionInContents|SectionNumbers|SectionNumInFigures\
|SectionNumInTheorems|SectSym|Select|SeparateIntroNumbering\
|Sequence|SetColour|ShadowBox|ShortDay|ShortHour\
|ShortMeriDiem|ShortMonth|ShortYear|ShowDirections\
|ShowPoints|ShowTags|Skip|SL|SolidArrowHead|SomeText\
|Square|Star|StarList|StartDown|StartEvenFoot|StartEvenTop\
|StartHSpan|StartHVSpan|StartLeft|StartOddFoot|StartOddTop\
|StartRight|StartRightDown|StartRightRight|StartUp\
|StartVSpan|Sterling|StructPageNums|StubSub|Style|Sub\
|SubAppendixInContents|SubAppendixNumInRunners|SubIndex\
|SubSection|SubSectionInContents|SubSubAppendixInContents|SubSubIndex\
|SubSubSectionInContents|Sup|SW||Sym|SymGamma|Symmu\
|SymMu|Symmultiply|Symweierstrass|SyntaxDiag|SysDatabase\
|SysInclude|SysIncludecommand|Table|TableCaptionPos\
|TableFormat|TableLocation|TableNumbers|Tag|TaggedList|TagItem\
|Tan|Tbl|TblSetup|Text|Theorem|TheoremFormat\
|TheoremTitleFormat|TheoremWord|TI|Time|Title|TitleNote\
|TitlePageFont|TL|TopMargin|TradeMark|Tree|TRType|True\
|TwelveHour|Type|UCAL|UCAlphaList|UCRL|UCRomanList\
|Underline|Unpaginated|URL|Use|UWrapArrow|UWrapCurve\
|UWrapCurveArrow|UWrapLine|Verbatim|Verbatimsymbol\
|VeryWideIndent|VeryWideTaggedList|VExpand|VHArrow|VHCurve\
|VHCurveArrow|VHLine|Volume|VShift|VSpan|VWTL|WideIndent\
|WideTaggedList|Word|WTL|XCell|Year|Yen|Yield\
|ZeroWidthLeftSub|ZeroWidthRightSub)
################################################################

# Perl mode, by Vladislav Zhuk <admin@dru.dn.ua>
/*.pl|/^#![ \t]*/.*/\perl\|-\*- *perl *-\*-
c3,4=(^|[^$])(#.*)$
c3,2=[^\\]("([^"\\]|\\\\(.|\n))*"|'([^'\\]|\\\\(.|\n))*')
c1,4=([^[:alnum:]_\$@#]|^)(abs|accept|alarm|atan2|bind|binmode|bless|caller\
|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|cos|crypt\
|dbmclose|dbmopen|define|delete|die|do|dump|each|eof|eval|exec|exists|exit|exp\
|fcntl|fileno|flock|fock|for|foreach|format|formline|getc|getlogin|getpeername\
|getpgrp|getppid|getpriority|getsockname|getsockopt|glob|gmtime|goto|grep\
|hex|if|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link\
|listen|local|localtime|log|lstat|map|mkdir|msgctl|msgget|msgsnd|msgrcv|my|next\
|no Module|oct|open|opendir|ord|pack|pipe|pop|pos|(s)?print(f)?|push|quotemeta\
|rand|read|readdir|readlink|recv|redo|ref|rename|require|reset|return|reverse\
|rewindir|rindex|rmdir|scalar|seek|seekdir|select|select( RBITS| WBITS| EBITS| TIMEOUT)?\
|semctl|semget|semop|send|setpgrp|setpriority|setsockopt|shift|shmget|shmget\
|shmread|shutdown|sin|sleep|soket|soketpair|sort|splice|split|sqrt\
|srand|stat|study|substr|symlink|syscall|sysread|system|syswrite|tell|telldir\
|tie|time|times|truncate|uc|ucfirst|umask|undef|unlink|unpack|untie|unshift\
|use|utime|values|vec|wait|waitpid|wantarray|warn|while|write|else|elsif\
|package|sub|BEGIN|END|INIT|CHECK|socket|defined\
)([^[:alnum:]/_]|$)
c2,1={|}|<<|<|>>|>|;;|;|\(|\)|=|=~|!=|&&|\|\||!|\.\.|<=>|&|^|->
c2,4=([ \t)]|^)(and|or|xor|eq|ne|cmp|lt|gt|le|ge)([ \t(]|$)
c2,4=([ \t(]|^)(not)([ \t(]|$)
