module Text.Highlighter.Lexers.Factor (lexer) where import Text.Regex.PCRE.Light import Text.Highlighter.Types lexer :: Lexer lexer = Lexer { lName = "Factor" , lAliases = ["factor"] , lExtensions = [".factor"] , lMimetypes = ["text/x-factor"] , lStart = root' , lFlags = [multiline, utf8] } stackeffect' :: TokenMatcher stackeffect' = [ tokNext "\\s*\\(" (Arbitrary "Name" :. Arbitrary "Function") (GoTo stackeffect') , tokNext "\\)" (Arbitrary "Name" :. Arbitrary "Function") Pop , tok "\\-\\-" (Arbitrary "Name" :. Arbitrary "Function") , tok "\\s+" (Arbitrary "Text") , tok "\\S+" (Arbitrary "Name" :. Arbitrary "Variable") ] import' :: TokenMatcher import' = [ tokNext ";" (Arbitrary "Keyword") Pop , tok "\\S+" (Arbitrary "Name" :. Arbitrary "Namespace") , tok "\\s+" (Arbitrary "Text") ] slots' :: TokenMatcher slots' = [ tok "\\s+" (Arbitrary "Text") , tokNext ";\\s" (Arbitrary "Keyword") Pop , tok "\\S+" (Arbitrary "Name" :. Arbitrary "Variable") ] root' :: TokenMatcher root' = [ tok "(\\s*)(:|::|MACRO:|MEMO:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Text"), (Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Function")]) , tok "(\\s*)(M:)(\\s+)(\\S+)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Text"), (Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Function")]) , tok "(\\s*)(GENERIC:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Text"), (Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Function")]) , tok "(\\s*)(HOOK:|GENERIC#)(\\s+)(\\S+)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Text"), (Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Function"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Function")]) , tokNext "(\\()(\\s+)" (ByGroups [(Arbitrary "Name" :. Arbitrary "Function"), (Arbitrary "Text")]) (GoTo stackeffect') , tok "\\;\\s" (Arbitrary "Keyword") , tokNext "(USING:)((?:\\s|\\\\\\s)+)" (ByGroups [(Arbitrary "Keyword" :. Arbitrary "Namespace"), (Arbitrary "Text")]) (GoTo import') , tok "(USE:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword" :. Arbitrary "Namespace"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Namespace")]) , tok "(UNUSE:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword" :. Arbitrary "Namespace"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Namespace")]) , tok "(QUALIFIED:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword" :. Arbitrary "Namespace"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Namespace")]) , tok "(QUALIFIED-WITH:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword" :. Arbitrary "Namespace"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Namespace")]) , tok "(FROM:|EXCLUDE:)(\\s+)(\\S+)(\\s+)(=>)" (ByGroups [(Arbitrary "Keyword" :. Arbitrary "Namespace"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Namespace"), (Arbitrary "Text"), (Arbitrary "Text")]) , tok "(IN:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword" :. Arbitrary "Namespace"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Namespace")]) , tok "(?:ALIAS|DEFER|FORGET|POSTPONE):" (Arbitrary "Keyword" :. Arbitrary "Namespace") , tokNext "(TUPLE:)(\\s+)(\\S+)(\\s+<\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class")]) (GoTo slots') , tokNext "(TUPLE:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class")]) (GoTo slots') , tok "(UNION:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class")]) , tok "(INTERSECTION:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class")]) , tok "(PREDICATE:)(\\s+)(\\S+)(\\s+<\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class")]) , tok "(C:)(\\s+)(\\S+)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Function"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Class")]) , tok "INSTANCE:" (Arbitrary "Keyword") , tok "SLOT:" (Arbitrary "Keyword") , tok "MIXIN:" (Arbitrary "Keyword") , tok "(?:SINGLETON|SINGLETONS):" (Arbitrary "Keyword") , tok "CONSTANT:" (Arbitrary "Keyword") , tok "(?:SYMBOL|SYMBOLS):" (Arbitrary "Keyword") , tok "ERROR:" (Arbitrary "Keyword") , tok "SYNTAX:" (Arbitrary "Keyword") , tok "(HELP:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Function")]) , tok "(MAIN:)(\\s+)(\\S+)" (ByGroups [(Arbitrary "Keyword" :. Arbitrary "Namespace"), (Arbitrary "Text"), (Arbitrary "Name" :. Arbitrary "Function")]) , tok "(?:ALIEN|TYPEDEF|FUNCTION|STRUCT):" (Arbitrary "Keyword") , tok "(?:)" (Arbitrary "Keyword" :. Arbitrary "Namespace") , tok "\"\"\"\\s+(?:.|\\n)*?\\s+\"\"\"" (Arbitrary "Literal" :. Arbitrary "String") , tok "\"(?:\\\\\\\\|\\\\\"|[^\"])*\"" (Arbitrary "Literal" :. Arbitrary "String") , tok "CHAR:\\s+(\\\\[\\\\abfnrstv]*|\\S)\\s" (Arbitrary "Literal" :. Arbitrary "String" :. Arbitrary "Char") , tok "\\!\\s+.*$" (Arbitrary "Comment") , tok "#\\!\\s+.*$" (Arbitrary "Comment") , tok "(t|f)\\s" (Arbitrary "Name" :. Arbitrary "Constant") , tok "-?\\d+\\.\\d+\\s" (Arbitrary "Literal" :. Arbitrary "Number" :. Arbitrary "Float") , tok "-?\\d+\\s" (Arbitrary "Literal" :. Arbitrary "Number" :. Arbitrary "Integer") , tok "HEX:\\s+[a-fA-F\\d]+\\s" (Arbitrary "Literal" :. Arbitrary "Number" :. Arbitrary "Hex") , tok "BIN:\\s+[01]+\\s" (Arbitrary "Literal" :. Arbitrary "Number" :. Arbitrary "Integer") , tok "OCT:\\s+[0-7]+\\s" (Arbitrary "Literal" :. Arbitrary "Number" :. Arbitrary "Oct") , tok "[-+/*=<>^]\\s" (Arbitrary "Operator") , tok "(?:deprecated|final|foldable|flushable|inline|recursive)\\s" (Arbitrary "Keyword") , tok "(?:or|2bi|2tri|while|wrapper|nip|4dip|wrapper\\\\?|bi\\\\*|callstack>array|both\\\\?|hashcode|die|dupd|callstack|callstack\\\\?|3dup|tri@|pick|curry|build|\\\\?execute|3bi|prepose|>boolean|\\\\?if|clone|eq\\\\?|tri\\\\*|\\\\?|=|swapd|2over|2keep|3keep|clear|2dup|when|not|tuple\\\\?|dup|2bi\\\\*|2tri\\\\*|call|tri-curry|object|bi@|do|unless\\\\*|if\\\\*|loop|bi-curry\\\\*|drop|when\\\\*|assert=|retainstack|assert\\\\?|-rot|execute|2bi@|2tri@|boa|with|either\\\\?|3drop|bi|curry\\\\?|datastack|until|3dip|over|3curry|tri-curry\\\\*|tri-curry@|swap|and|2nip|throw|bi-curry|\\\\(clone\\\\)|hashcode\\\\*|compose|2dip|if|3tri|unless|compose\\\\?|tuple|keep|2curry|equal\\\\?|assert|tri|2drop|most||boolean\\\\?|identity-hashcode|identity-tuple\\\\?|null|new|dip|bi-curry@|rot|xor|identity-tuple|boolean)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:\\\\?at|assoc\\\\?|assoc-clone-like|assoc=|delete-at\\\\*|assoc-partition|extract-keys|new-assoc|value\\\\?|assoc-size|map>assoc|push-at|assoc-like|key\\\\?|assoc-intersect|assoc-refine|update|assoc-union|assoc-combine|at\\\\*|assoc-empty\\\\?|at\\\\+|set-at|assoc-all\\\\?|assoc-subset\\\\?|assoc-hashcode|change-at|assoc-each|assoc-diff|zip|values|value-at|rename-at|inc-at|enum\\\\?|at|cache|assoc>map||assoc|assoc-map|enum|value-at\\\\*|assoc-map-as|>alist|assoc-filter-as|clear-assoc|assoc-stack|maybe-set-at|substitute|assoc-filter|2cache|delete-at|assoc-find|keys|assoc-any\\\\?|unzip)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:case|execute-effect|no-cond|no-case\\\\?|3cleave>quot|2cleave|cond>quot|wrong-values\\\\?|no-cond\\\\?|cleave>quot|no-case|case>quot|3cleave|wrong-values|to-fixed-point|alist>quot|case-find|cond|cleave|call-effect|2cleave>quot|recursive-hashcode|linear-case-quot|spread|spread>quot)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:number=|if-zero|next-power-of-2|each-integer|\\\\?1\\\\+|fp-special\\\\?|imaginary-part|unless-zero|float>bits|number\\\\?|fp-infinity\\\\?|bignum\\\\?|fp-snan\\\\?|denominator|fp-bitwise=|\\\\*|\\\\+|power-of-2\\\\?|-|u>=|/|>=|bitand|log2-expects-positive|<|log2|>|integer\\\\?|number|bits>double|2/|zero\\\\?|(find-integer)|bits>float|float\\\\?|shift|ratio\\\\?|even\\\\?|ratio|fp-sign|bitnot|>fixnum|complex\\\\?|/i|/f|byte-array>bignum|when-zero|sgn|>bignum|next-float|u<|u>|mod|recip|rational|find-last-integer|>float|(all-integers\\\\?)|2^|times|integer|fixnum\\\\?|neg|fixnum|sq|bignum|(each-integer)|bit\\\\?|fp-qnan\\\\?|find-integer|complex||real|double>bits|bitor|rem|fp-nan-payload|all-integers\\\\?|real-part|log2-expects-positive\\\\?|prev-float|align|unordered\\\\?|float|fp-nan\\\\?|abs|bitxor|u<=|odd\\\\?|<=|/mod|rational\\\\?|>integer|real\\\\?|numerator)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:member-eq\\\\?|append|assert-sequence=|find-last-from|trim-head-slice|clone-like|3sequence|assert-sequence\\\\?|map-as|last-index-from|reversed|index-from|cut\\\\*|pad-tail|remove-eq!|concat-as|but-last|snip|trim-tail|nths|nth|2selector|sequence|slice\\\\?||partition|remove-nth|tail-slice|empty\\\\?|tail\\\\*|if-empty|find-from|virtual-sequence\\\\?|member\\\\?|set-length|drop-prefix|unclip|unclip-last-slice|iota|map-sum|bounds-error\\\\?|sequence-hashcode-step|selector-for|accumulate-as|map|start|midpoint@|\\\\(accumulate\\\\)|rest-slice|prepend|fourth|sift|accumulate!|new-sequence|follow|map!|like|first4|1sequence|reverse|slice|unless-empty|padding|virtual@|repetition\\\\?|set-last|index|4sequence|max-length|set-second|immutable-sequence|first2|first3|replicate-as|reduce-index|unclip-slice|supremum|suffix!|insert-nth|trim-tail-slice|tail|3append|short|count|suffix|concat|flip|filter|sum|immutable\\\\?|reverse!|2sequence|map-integers|delete-all|start\\\\*|indices|snip-slice|check-slice|sequence\\\\?|head|map-find|filter!|append-as|reduce|sequence=|halves|collapse-slice|interleave|2map|filter-as|binary-reduce|slice-error\\\\?|product|bounds-check\\\\?|bounds-check|harvest|immutable|virtual-exemplar|find|produce|remove|pad-head|last|replicate|set-fourth|remove-eq|shorten|reversed\\\\?|map-find-last|3map-as|2unclip-slice|shorter\\\\?|3map|find-last|head-slice|pop\\\\*|2map-as|tail-slice\\\\*|but-last-slice|2map-reduce|iota\\\\?|collector-for|accumulate|each|selector|append!|new-resizable|cut-slice|each-index|head-slice\\\\*|2reverse-each|sequence-hashcode|pop|set-nth|\\\\?nth||second|join|when-empty|collector|immutable-sequence\\\\?||all\\\\?|3append-as|virtual-sequence|subseq\\\\?|remove-nth!|push-either|new-like|length|last-index|push-if|2all\\\\?|lengthen|assert-sequence|copy|map-reduce|move|third|first|3each|tail\\\\?|set-first|prefix|bounds-error|any\\\\?||trim-slice|exchange|surround|2reduce|cut|change-nth|min-length|set-third|produce-as|push-all|head\\\\?|delete-slice|rest|sum-lengths|2each|head\\\\*|infimum|remove!|glue|slice-error|subseq|trim|replace-slice|push|repetition|map-index|trim-head|unclip-last|mismatch)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:global|\\\\+@|change|set-namestack|change-global|init-namespaces|on|off|set-global|namespace|set|with-scope|bind|with-variable|inc|dec|counter|initialize|namestack|get|get-global|make-assoc)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:|2array|3array|pair|>array|1array|4array|pair\\\\?|array|resize-array|array\\\\?)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:\\\\+character\\\\+|bad-seek-type\\\\?|readln|each-morsel|stream-seek|read|print|with-output-stream|contents|write1|stream-write1|stream-copy|stream-element-type|with-input-stream|stream-print|stream-read|stream-contents|stream-tell|tell-output|bl|seek-output|bad-seek-type|nl|stream-nl|write|flush|stream-lines|\\\\+byte\\\\+|stream-flush|read1|seek-absolute\\\\?|stream-read1|lines|stream-readln|stream-read-until|each-line|seek-end|with-output-stream\\\\*|seek-absolute|with-streams|seek-input|seek-relative\\\\?|input-stream|stream-write|read-partial|seek-end\\\\?|seek-relative|error-stream|read-until|with-input-stream\\\\*|with-streams\\\\*|tell-input|each-block|output-stream|stream-read-partial|each-stream-block|each-stream-line)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:resize-string|>string||1string|string|string\\\\?)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:vector\\\\?||\\\\?push|vector|>vector|1vector)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "(?:with-return|restarts|return-continuation|with-datastack|recover|rethrow-restarts||ifcc|set-catchstack|>continuation<|cleanup|ignore-errors|restart\\\\?|compute-restarts|attempt-all-error|error-thread|continue||attempt-all-error\\\\?|condition\\\\?||throw-restarts|error|catchstack|continue-with|thread-error-hook|continuation|rethrow|callcc1|error-continuation|callcc0|attempt-all|condition|continuation\\\\?|restart|return)\\s" (Arbitrary "Name" :. Arbitrary "Builtin") , tok "\\s+" (Arbitrary "Text") , tok "\\S+" (Arbitrary "Text") ]