Issue #401 on hold
Anonymous created an issue

== Lexer for [ FalconPL] ==

  • File: ''./pygments/lexers/'' {{{ 'FalconLexer': ('pygments.lexers.agile', 'FalconPL' ('falconpl', 'falcon'), ('.fal', '.ftd'), ('text/x-falconpl', 'application/x-falconpl')), }}}

  • File: ''./pygments/lexers/'' {{{ class FalconLexer(RegexLexer): """ For FalconPL <>_ source code. """ name = 'FalconPL' aliases = ['falconpl', 'falcon'] filenames = ['.fal', '.ftd'] mimetypes = ['text/x-falconpl', 'application/x-falconpl']

    tokens = { 'root': [ (r'\n', Text), (r'\s+', Text), # Comments (r'//(.?)$', Comment.Single), (r'/\(.?)\/', Comment.Multiline), # Keywords (r'(break|continue|dropping|return|launch|from|global|const|self' r'|catch|raise|case|default|def|directive' r'|load|export|loop|while|for|function|innerfunc|init|static' r'|attributes|forfirst|forlast|formiddle|enum|try|class|switch' r'|select|object|if|elif|else|end)\b', Keyword), # Items (r'(nil|false|true)\b', Name.Builtin.Pseudo), # or Keyword.Pseudo # Operators (r'[+^?=/&%$£!=|:-+@#]=?', Operator), (r'(and|or|not|in|notin|to|provides|as)\b', Operator.Word), # Numbers (r'(0|[1-9][0-9_])', Number.Integer), (r'([0-9][0-9_]*)?\.[0-9_]+([eE][+\-]?[0-9_]+)?', Number.Float), # [+-][0-9]+(.[0-9]+)?([eE][0-9]+)? (r'0[xX][a-fA-F0-9_]+', Number.Hex), (r'0[cC]?[0-7_]+', Number.Oct), (r'0[Bb][01_]+', Number), # Binary # Identifiers (r'[^0-9_]\w+', Name.Variable), (r'_\w+', Name.Variable.Instance), # For module too # Functions and classes (r'(all|any|allp|anyp|eval|choice|xmap|iff|lit|cascade|dolist|eq)\b', Name.Function), (r'(List)\b'), Name.Class, # Other (r'(tracestep)\b', Name.Builtin), # Exceptions (r'(SyntaxError|CodeError|RangeError|MathError|IoError|TypeError' r'|ParamError|ParseError|CloneError|InterruptedError|Error)\b', Name.Exception), ], }


Reported by falconpl

Comments (9)

  1. thatch

    I've never heard of Falcon before, but the lexer looks decent. Please provide examplefiles that demonstrate a good portion of the language (under a suitable license). The examples I found didn't work due to parens and square brackets (among others) being error tokens. `` needs to be escaped, btw, or it goes infinite-loop on the first character.

  2. Log in to comment