module Text.Highlighter.Lexers.AppleScript (lexer) where import Text.Regex.PCRE.Light import Text.Highlighter.Types lexer :: Lexer lexer = Lexer { lName = "AppleScript" , lAliases = ["applescript"] , lExtensions = [".applescript"] , lMimetypes = [] , lStart = root' , lFlags = [multiline, dotall] } comment' :: TokenMatcher comment' = [ tokNext "\\(\\*" (Arbitrary "Comment" :. Arbitrary "Multiline") Push , tokNext "\\*\\)" (Arbitrary "Comment" :. Arbitrary "Multiline") Pop , tok "[^*(]+" (Arbitrary "Comment" :. Arbitrary "Multiline") , tok "[*(]" (Arbitrary "Comment" :. Arbitrary "Multiline") ] root' :: TokenMatcher root' = [ tok "\\s+" (Arbitrary "Text") , tok "\172\\n" (Arbitrary "Literal" :. Arbitrary "String" :. Arbitrary "Escape") , tok "'s\\s+" (Arbitrary "Text") , tok "(--|#).*?$" (Arbitrary "Comment") , tokNext "\\(\\*" (Arbitrary "Comment" :. Arbitrary "Multiline") (GoTo comment') , tok "[\\(\\){}!,.:]" (Arbitrary "Punctuation") , tok "(\171)([^\187]+)(\187)" (ByGroups [(Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Builtin"), (Arbitrary "Text")]) , tok "\\b((?:considering|ignoring)\\s*)(application responses|case|diacriticals|hyphens|numeric strings|punctuation|white space)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Name" :. Arbitrary "Builtin")]) , tok "(-|\\*|\\+|&|\8800|>=?|<=?|=|\8805|\8804|/|\247|\\^)" (Arbitrary "Operator") , tok "\\b(and|or|is equal|equals|(is )?equal to|is not|isn't|isn't equal( to)?|is not equal( to)?|doesn't equal|does not equal|(is )?greater than|comes after|is not less than or equal( to)?|isn't less than or equal( to)?|(is )?less than|comes before|is not greater than or equal( to)?|isn't greater than or equal( to)?|(is )?greater than or equal( to)?|is not less than|isn't less than|does not come before|doesn't come before|(is )?less than or equal( to)?|is not greater than|isn't greater than|does not come after|doesn't come after|starts? with|begins? with|ends? with|contains?|does not contain|doesn't contain|is in|is contained by|is not in|is not contained by|isn't contained by|div|mod|not|(a )?(ref( to)?|reference to)|is|does)\\b" (Arbitrary "Operator" :. Arbitrary "Word") , tok "^(\\s*(?:on|end)\\s+)(accept outline drop|accept table drop|action|activated|alert ended|awake from nib|became key|became main|begin editing|bounds changed|cell value|cell value changed|change cell value|change item value|changed|child of item|choose menu item|clicked|clicked toolbar item|closed|column clicked|column moved|column resized|conclude drop|data representation|deminiaturized|dialog ended|document nib name|double clicked|drag( (entered|exited|updated))?|drop|end editing|exposed|idle|item expandable|item value|item value changed|items changed|keyboard down|keyboard up|launched|load data representation|miniaturized|mouse down|mouse dragged|mouse entered|mouse exited|mouse moved|mouse up|moved|number of browser rows|number of items|number of rows|open untitled|opened|panel ended|parameters updated|plugin loaded|prepare drop|prepare outline drag|prepare outline drop|prepare table drag|prepare table drop|read from file|resigned active|resigned key|resigned main|resized( sub views)?|right mouse down|right mouse dragged|right mouse up|rows changed|scroll wheel|selected tab view item|selection changed|selection changing|should begin editing|should close|should collapse item|should end editing|should expand item|should open( untitled)?|should quit( after last window closed)?|should select column|should select item|should select row|should select tab view item|should selection change|should zoom|shown|update menu item|update parameters|update toolbar item|was hidden|was miniaturized|will become active|will close|will dismiss|will display browser cell|will display cell|will display item cell|will display outline cell|will finish launching|will hide|will miniaturize|will move|will open|will pop up|will quit|will resign active|will resize( sub views)?|will select tab view item|will show|will zoom|write to file|zoomed)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Name" :. Arbitrary "Function")]) , tok "^(\\s*)(in|on|script|to)(\\s+)" (ByGroups [(Arbitrary "Text"), (Arbitrary "Keyword"), (Arbitrary "Text")]) , tok "\\b(as )(alias |application |boolean |class |constant |date |file |integer |list |number |POSIX file |real |record |reference |RGB color |script |text |unit types|(Unicode )?text|string)\\b" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Name" :. Arbitrary "Class")]) , tok "\\b(AppleScript|current application|false|linefeed|missing value|pi|quote|result|return|space|tab|text item delimiters|true|version)\\b" (Arbitrary "Name" :. Arbitrary "Constant") , tok "\\b(ASCII (character|number)|activate|beep|choose URL|choose application|choose color|choose file( name)?|choose folder|choose from list|choose remote application|clipboard info|close( access)?|copy|count|current date|delay|delete|display (alert|dialog)|do shell script|duplicate|exists|get eof|get volume settings|info for|launch|list (disks|folder)|load script|log|make|mount volume|new|offset|open( (for access|location))?|path to|print|quit|random number|read|round|run( script)?|say|scripting components|set (eof|the clipboard to|volume)|store script|summarize|system attribute|system info|the clipboard|time to GMT|write|quoted form)\\b" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "\\b(considering|else|error|exit|from|if|ignoring|in|repeat|tell|then|times|to|try|until|using terms from|while|whith|with timeout( of)?|with transaction|by|continue|end|its?|me|my|return|of|as)\\b" (Arbitrary "Keyword") , tok "\\b(global|local|prop(erty)?|set|get)\\b" (Arbitrary "Keyword") , tok "\\b(but|put|returning|the)\\b" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "\\b(attachment|attribute run|character|day|month|paragraph|word|year)s?\\b" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "\\b(about|above|against|apart from|around|aside from|at|below|beneath|beside|between|for|given|instead of|on|onto|out of|over|since)\\b" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "\\b(accepts arrow key|action method|active|alignment|allowed identifiers|allows branch selection|allows column reordering|allows column resizing|allows column selection|allows customization|allows editing text attributes|allows empty selection|allows mixed state|allows multiple selection|allows reordering|allows undo|alpha( value)?|alternate image|alternate increment value|alternate title|animation delay|associated file name|associated object|auto completes|auto display|auto enables items|auto repeat|auto resizes( outline column)?|auto save expanded items|auto save name|auto save table columns|auto saves configuration|auto scroll|auto sizes all columns to fit|auto sizes cells|background color|bezel state|bezel style|bezeled|border rect|border type|bordered|bounds( rotation)?|box type|button returned|button type|can choose directories|can choose files|can draw|can hide|cell( (background color|size|type))?|characters|class|click count|clicked( data)? column|clicked data item|clicked( data)? row|closeable|collating|color( (mode|panel))|command key down|configuration|content(s| (size|view( margins)?))?|context|continuous|control key down|control size|control tint|control view|controller visible|coordinate system|copies( on scroll)?|corner view|current cell|current column|current( field)? editor|current( menu)? item|current row|current tab view item|data source|default identifiers|delta (x|y|z)|destination window|directory|display mode|displayed cell|document( (edited|rect|view))?|double value|dragged column|dragged distance|dragged items|draws( cell)? background|draws grid|dynamically scrolls|echos bullets|edge|editable|edited( data)? column|edited data item|edited( data)? row|enabled|enclosing scroll view|ending page|error handling|event number|event type|excluded from windows menu|executable path|expanded|fax number|field editor|file kind|file name|file type|first responder|first visible column|flipped|floating|font( panel)?|formatter|frameworks path|frontmost|gave up|grid color|has data items|has horizontal ruler|has horizontal scroller|has parent data item|has resize indicator|has shadow|has sub menu|has vertical ruler|has vertical scroller|header cell|header view|hidden|hides when deactivated|highlights by|horizontal line scroll|horizontal page scroll|horizontal ruler view|horizontally resizable|icon image|id|identifier|ignores multiple clicks|image( (alignment|dims when disabled|frame style|scaling))?|imports graphics|increment value|indentation per level|indeterminate|index|integer value|intercell spacing|item height|key( (code|equivalent( modifier)?|window))?|knob thickness|label|last( visible)? column|leading offset|leaf|level|line scroll|loaded|localized sort|location|loop mode|main( (bunde|menu|window))?|marker follows cell|matrix mode|maximum( content)? size|maximum visible columns|menu( form representation)?|miniaturizable|miniaturized|minimized image|minimized title|minimum column width|minimum( content)? size|modal|modified|mouse down state|movie( (controller|file|rect))?|muted|name|needs display|next state|next text|number of tick marks|only tick mark values|opaque|open panel|option key down|outline table column|page scroll|pages across|pages down|palette label|pane splitter|parent data item|parent window|pasteboard|path( (names|separator))?|playing|plays every frame|plays selection only|position|preferred edge|preferred type|pressure|previous text|prompt|properties|prototype cell|pulls down|rate|released when closed|repeated|requested print time|required file type|resizable|resized column|resource path|returns records|reuses columns|rich text|roll over|row height|rulers visible|save panel|scripts path|scrollable|selectable( identifiers)?|selected cell|selected( data)? columns?|selected data items?|selected( data)? rows?|selected item identifier|selection by rect|send action on arrow key|sends action when done editing|separates columns|separator item|sequence number|services menu|shared frameworks path|shared support path|sheet|shift key down|shows alpha|shows state by|size( mode)?|smart insert delete enabled|sort case sensitivity|sort column|sort order|sort type|sorted( data rows)?|sound|source( mask)?|spell checking enabled|starting page|state|string value|sub menu|super menu|super view|tab key traverses cells|tab state|tab type|tab view|table view|tag|target( printer)?|text color|text container insert|text container origin|text returned|tick mark position|time stamp|title(d| (cell|font|height|position|rect))?|tool tip|toolbar|trailing offset|transparent|treat packages as directories|truncated labels|types|unmodified characters|update views|use sort indicator|user defaults|uses data source|uses ruler|uses threaded animation|uses title from previous column|value wraps|version|vertical( (line scroll|page scroll|ruler view))?|vertically resizable|view|visible( document rect)?|volume|width|window|windows menu|wraps|zoomable|zoomed)\\b" (Arbitrary "Name" :. Arbitrary "Attribute") , tok "\\b(action cell|alert reply|application|box|browser( cell)?|bundle|button( cell)?|cell|clip view|color well|color-panel|combo box( item)?|control|data( (cell|column|item|row|source))?|default entry|dialog reply|document|drag info|drawer|event|font(-panel)?|formatter|image( (cell|view))?|matrix|menu( item)?|item|movie( view)?|open-panel|outline view|panel|pasteboard|plugin|popup button|progress indicator|responder|save-panel|scroll view|secure text field( cell)?|slider|sound|split view|stepper|tab view( item)?|table( (column|header cell|header view|view))|text( (field( cell)?|view))?|toolbar( item)?|user-defaults|view|window)s?\\b" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "\\b(animate|append|call method|center|close drawer|close panel|display|display alert|display dialog|display panel|go|hide|highlight|increment|item for|load image|load movie|load nib|load panel|load sound|localized string|lock focus|log|open drawer|path for|pause|perform action|play|register|resume|scroll|select( all)?|show|size to fit|start|step back|step forward|stop|synchronize|unlock focus|update)\\b" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "\\b((in )?back of|(in )?front of|[0-9]+(st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|after|back|before|behind|every|front|index|last|middle|some|that|through|thru|where|whose)\\b" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "\"(\\\\\\\\|\\\\\"|[^\"])*\"" (Arbitrary "Literal" :. Arbitrary "String" :. Arbitrary "Double") , tok "\\b([a-zA-Z]\\w*)\\b" (Arbitrary "Name" :. Arbitrary "Variable") , tok "[-+]?(\\d+\\.\\d*|\\d*\\.\\d+)(E[-+][0-9]+)?" (Arbitrary "Literal" :. Arbitrary "Number" :. Arbitrary "Float") , tok "[-+]?\\d+" (Arbitrary "Literal" :. Arbitrary "Number" :. Arbitrary "Integer") ]