Lexer and Autocomplete for Falcon
Lexer and Autocomplete for Falcon
Hi all,
Just letting you know that I've created a Lexer & Autocomplete file for the Falcon Programming Language (http://www.falconpl.org/index.ftd?page_id=contacts).
I'm still getting to grips with this language, so it may not be 100% accurate, but when testing in CudaText it seems to do a reasonable job.
If you have any queries, comments or suggestions, please let me know.
Regards
Shando
PS: Can't upload zip files to the forum, so here's a link to it on OneDrive:
https://1drv.ms/u/s!Au7DMGV6totzgoZWH4qhMPs-dFLX3g
Just letting you know that I've created a Lexer & Autocomplete file for the Falcon Programming Language (http://www.falconpl.org/index.ftd?page_id=contacts).
I'm still getting to grips with this language, so it may not be 100% accurate, but when testing in CudaText it seems to do a reasonable job.
If you have any queries, comments or suggestions, please let me know.
Regards
Shando
PS: Can't upload zip files to the forum, so here's a link to it on OneDrive:
https://1drv.ms/u/s!Au7DMGV6totzgoZWH4qhMPs-dFLX3g
The .cuda-lexmap file is empty, can you pls fill?
http://wiki.freepascal.org/CudaText#I_h ... bute_it.3F
http://wiki.freepascal.org/CudaText#I_h ... bute_it.3F
2) you didn't fill "comment for range" chars in dialog.
3) I filled .cuda-lexmap file for you:
3) I filled .cuda-lexmap file for you:
Code: Select all
[comments]
str1=
str2=
styles_cmt=
styles_str=
[map]
Symbol=Symbol
Number=Number
String=String
Identifier=Id
Id Keyword=IdKeyword
Id Logical=Id2
Id brackets=Id1
Comment=Comment
Preprocessor=CommentDoc
I waited 10 days and now have edited lexer by myself.
-added new .cuda-lexmap file
-removed Grammar list (grammar was not used; it may slow down lexer; file now smaller by 10K)
-edited Rules names a little
-edited 2 regex (added \b for 'case')
-removed rules for brackets ()[]{}, we have Brackets Hilite plugin
-hidden if/for/while/..... from code tree
Published in AddonManager.
-added new .cuda-lexmap file
-removed Grammar list (grammar was not used; it may slow down lexer; file now smaller by 10K)
-edited Rules names a little
-edited 2 regex (added \b for 'case')
-removed rules for brackets ()[]{}, we have Brackets Hilite plugin
-hidden if/for/while/..... from code tree
Published in AddonManager.
Hey buddy,
Sorry for not getting back to you sooner. I've just started a new job and don't have much time for anything else at the moment.
Thanks for doing this. I'll check it out.
Shando
PS: The Single Line versions do not show in the tree correctly. For example:
The first 3 functions above show correctly (I presume because the 'function' keyword will end a previous function), but the last one allows the collapse of the function as well as the following lines.
Sorry for not getting back to you sooner. I've just started a new job and don't have much time for anything else at the moment.
Thanks for doing this. I'll check it out.
Shando
PS: The Single Line versions do not show in the tree correctly. For example:
Code: Select all
function f1(): > "I am f1"
function f2(): > "I am f2"
function f3(): > "I am f3"
function f4(): > "I am f4"
// subscribe regularly f1 and f2
subscribe( "printme", f1 )
subscribe( "printme", f2 )
1- How can i see that this is single line function, not multi line?
2- I removed from lexer all grammar list, wasnt used, here it is if you need it:
2- I removed from lexer all grammar list, wasnt used, here it is if you need it:
Code: Select all
EOL ::= "\n"
INTNUM ::= "(\d+$)|(0[0-7]+)|(0[xX][0-9a-fA-F]+)"
DBLNUM ::= "( 0 | [1-9][0-9]* ) (\.[0-9]+)? ( [eE][\+|-]? [0-9]+ )? )"
SYMBOL ::= "[/\+\-\*=<>&/\|\^\.!\\\?%]+"
STRING ::= String
NIL ::= "null"
UNB ::= "_"
END ::= "end"
DEF ::= "def"
WHILE ::= "while"
BREAK ::= "break"
CONTINUE ::= "continue"
DROPPING ::= "dropping"
IF ::= "if"
ELSE ::= "else"
ELIF ::= "elif"
FOR ::= "for"
FORFIRST ::= "forfirst"
FORLAST ::= "forlast"
FORMIDDLE ::= "formiddle"
SWITCH ::= "switch"
CASE ::= "case"
DEFAULT ::= "default"
SELECT ::= "select"
SELF ::= "self"
FSELF ::= "fself"
TRY ::= "try"
CATCH ::= "catch"
RAISE ::= "raise"
CLASS ::= "class"
FROM ::= "from"
OBJECT ::= "object"
RETURN ::= "return"
GLOBAL ::= "global"
INIT ::= "init"
LOAD ::= "load"
LAUNCH ::= "launch"
CONST_KW ::= "const"
EXPORT ::= "export"
IMPORT ::= "import"
DIRECTIVE ::= "directive"
COLON ::= ":"
FUNCDECL ::= "funcdecl"
STATIC ::= "static"
INNERFUNC ::= "innerfunc"
FORDOT ::= "\.="
LISTPAR ::= "\.\["
LOOP ::= "loop"
ENUM ::= "enum"
TRUE_TOKEN ::= "true"
FALSE_TOKEN ::= "false"
//OUTER_STRING 309
CLOSEPAR ::= "\("
OPENPAR ::= "\)"
CLOSESQUARE ::= "]"
OPENSQUARE ::= "\["
DOT ::= "\."
OPEN_GRAPH ::= "\{"
CLOSE_GRAPH ::= "\}"
ARROW ::= ">"
VBAR ::= "\|"
ASSIGN_POW ::= "\*\*="
ASSIGN_SHL ::= "<<="
ASSIGN_SHR ::= ">>="
ASSIGN_BXOR ::= "\^="
ASSIGN_BOR ::= "\|="
ASSIGN_BAND ::= "&="
ASSIGN_MOD ::= "%="
ASSIGN_DIV ::= "/="
ASSIGN_MUL ::= "\*="
ASSIGN_SUB ::= "-="
ASSIGN_ADD ::= "\+="
OP_EQ ::= "=(^[^=|^>])"
OP_AS ::= "as"
OP_TO ::= "to"
COMMA ::= ","
QUESTION ::= "\?"
OR ::= "or"
AND ::= "and"
NOT ::= "not"
LE ::= "<="
GE ::= ">="
LT ::= "<(^[^=|^<])"
GT ::= ">^([^=|^>])"
NEQ ::= "!="
EEQ ::= "=="
OP_EXEQ ::= "eq"
PROVIDES ::= "provides"
OP_NOTIN ::= "notin"
OP_IN ::= "in"
DIESIS ::= "#"
ATSIGN ::= "@"
CAP_CAP ::= "\^\^"
VBAR_VBAR ::= "\|\|"
AMPER_AMPER ::= "&&"
MINUS ::= "-"
PLUS ::= "\+"
PERCENT ::= "%"
SLASH ::= "(/^([^=|^/|^\*]))"
STAR ::= "\*"
POW ::= "[\*\*][^=]"
SHR ::= "[>>][^=]"
SHL ::= "[<<][^=]"
CAP_XOROOB ::= "\^!"
CAP_ISOOB ::= "\^\?"
CAP_DEOOB ::= "\^-"
CAP_OOB ::= "\^\+"
CAP_EVAL ::= "\^\*"
TILDE ::= "~"
NEG ::= "-"
AMPER ::= "&"
DECREMENT ::= "\+\+"
INCREMENT ::= "--"
DOLLAR ::= "\$"
line ::= toplevel_statement | END EOL
toplevel_statement ::= load_statement | directive_statement | func_statement | class_decl | object_decl | enum_statement | statement | const_statement | export_statement | import_statement
INTNUM_WITH_MINUS ::= MINUS? INTNUM
load_statement ::= LOAD ( SYMBOL | STRING ) EOL
statement ::= base_statement | attribute_statement | ( ( FUNCDECL | OBJECT | CLASS )? )? EOL
base_statement ::= ( expression | expression_list OP_EQ expression ( COMMA expression_list )? ) EOL | def_statement | while_statement | loop_statement | forin_statement | switch_statement | select_statement | if_statement | break_statement | continue_statement | try_statement | raise_statement | return_statement | global_statement | launch_statement | fordot_statement | self_print_statement
//base_statement ::= ( expression | expression_list OP_EQ expression ( COMMA expression_list )? ) EOL | def_statement | while_statement | loop_statement | forin_statement | switch_statement | select_statement | if_statement | break_statement | continue_statement | try_statement | raise_statement | return_statement | global_statement | launch_statement | fordot_statement | self_print_statement | outer_print_statement
assignment_def_list_element ::= atomic_symbol ( OP_EQ expression )?
def_statement ::= DEF ( assignment_def_list_element ( COMMA assignment_def_list_element )* ) EOL
while_statement ::= while_decl statement_list END EOL | while_short_decl statement
while_decl ::= WHILE expression EOL
while_short_decl ::= WHILE expression COLON
loop_statement ::= LOOP ( EOL statement_list END loop_terminator EOL | COLON statement )
loop_terminator ::= expression?
if_statement ::= if_decl statement_list elif_or_else END EOL | if_short_decl statement
if_decl ::= IF expression EOL
if_short_decl ::= IF expression COLON
elif_or_else ::= ( elif_statement | else_decl statement_list )?
else_decl ::= ELSE EOL
elif_statement ::= elif_decl statement_list elif_or_else
elif_decl ::= ELIF expression EOL
statement_list ::= statement*
break_statement ::= BREAK EOL
continue_statement ::= CONTINUE ( DROPPING )? EOL
forin_header ::= FOR ( symbol_list OP_IN expression | atomic_symbol OP_EQ for_to_expr )
forin_statement ::= forin_header ( COLON statement | EOL forin_statement_elem* END EOL )
for_to_expr ::= expression OP_TO expression for_to_step_clause
for_to_step_clause ::= ( COMMA expression )?
forin_statement_elem ::= statement | first_loop_block | last_loop_block | middle_loop_block
fordot_statement ::= FORDOT expression EOL
self_print_statement ::= ( SHR | GT ) ( expression_list )? EOL
//outer_print_statement ::= OUTER_STRING
first_loop_block ::= FORFIRST ( EOL statement_list END EOL | COLON statement )
last_loop_block ::= FORLAST ( EOL statement_list END EOL | COLON statement )
middle_loop_block ::= FORMIDDLE ( EOL statement_list END EOL | COLON statement )
switch_statement ::= switch_decl ( case_statement )* default_statement END EOL
switch_decl ::= SWITCH expression EOL
case_statement ::= EOL | CASE case_expression_list ( EOL statement_list | COLON statement )
default_statement ::= ( default_decl default_body )?
default_decl ::= ( DEFAULT )?
default_body ::= EOL statement_list | COLON statement
case_expression_list ::= case_element ( COMMA case_element )*
case_element ::= NIL | INTNUM_WITH_MINUS ( OP_TO INTNUM_WITH_MINUS )? | STRING | SYMBOL
select_statement ::= select_decl ( selcase_statement )* default_statement END EOL
select_decl ::= SELECT expression EOL
selcase_statement ::= EOL | CASE selcase_expression_list ( EOL statement_list | COLON statement )
selcase_expression_list ::= selcase_element ( COMMA selcase_element )*
selcase_element ::= ( INTNUM | SYMBOL )?
try_statement ::= TRY COLON statement | try_decl statement_list catch_statements END EOL
try_decl ::= TRY EOL
catch_statements ::= catch_statement*
catch_statement ::= catch_decl statement_list
catch_decl ::= CATCH catchcase_element_list? ( OP_IN atomic_symbol )? EOL
catchcase_element_list ::= catchcase_element ( COMMA catchcase_element )*
catchcase_element ::= INTNUM | SYMBOL
raise_statement ::= RAISE expression EOL
func_statement ::= func_decl static_block statement_list END EOL | func_decl_short statement
func_decl ::= func_begin OPENPAR param_list CLOSEPAR EOL
func_decl_short ::= func_begin OPENPAR param_list CLOSEPAR COLON
func_begin ::= FUNCDECL SYMBOL
param_list ::= param_symbol? ( COMMA param_symbol )*
param_symbol ::= SYMBOL
static_block ::= ( static_decl statement_list END EOL | static_short_decl statement )?
static_decl ::= STATIC EOL
static_short_decl ::= STATIC COLON
launch_statement ::= LAUNCH func_call EOL
const_statement ::= CONST_KW SYMBOL OP_EQ const_atom EOL
export_statement ::= EXPORT ( SYMBOL ( COMMA SYMBOL )* )? EOL
import_statement ::= IMPORT ( import_symbol_list ( FROM ( SYMBOL | STRING ) ( ( OP_AS | OP_IN ) SYMBOL )? )? | SYMBOL? | FROM ( SYMBOL | STRING ) ( OP_IN SYMBOL )? ) EOL
attribute_statement ::= SYMBOL COLON const_atom EOL
import_symbol_list ::= SYMBOL ( COMMA SYMBOL )*
directive_statement ::= DIRECTIVE directive_pair ( COMMA directive_pair )* EOL
directive_pair ::= SYMBOL OP_EQ ( SYMBOL | STRING | INTNUM_WITH_MINUS )
class_decl ::= CLASS SYMBOL class_def_inner class_statement* END EOL
class_def_inner ::= class_param_list from_clause EOL
class_param_list ::= ( OPENPAR param_list CLOSEPAR )?
from_clause ::= ( FROM inherit_token ( COMMA inherit_token )* )?
inherit_token ::= SYMBOL inherit_call
inherit_call ::= ( OPENPAR expression_list? CLOSEPAR )?
class_statement ::= EOL | func_statement | property_decl | state_decl | init_decl | attribute_statement
init_decl ::= INIT EOL static_block statement_list END EOL
property_decl ::= ( STATIC SYMBOL OP_EQ const_atom | SYMBOL OP_EQ expression ) EOL
state_decl ::= state_heading state_statement* END EOL
state_heading ::= OPENSQUARE ( SYMBOL | INIT ) CLOSESQUARE EOL
state_statement ::= EOL | func_statement
enum_statement ::= ENUM SYMBOL EOL enum_item_decl* END EOL
enum_item_decl ::= EOL | SYMBOL ( OP_EQ const_atom )? enum_item_terminator | attribute_statement
enum_item_terminator ::= EOL | COMMA
object_decl ::= OBJECT SYMBOL object_decl_inner object_statement* END EOL
object_decl_inner ::= from_clause EOL
object_statement ::= EOL | func_statement | property_decl | init_decl | attribute_statement
global_statement ::= GLOBAL globalized_symbol ( COMMA globalized_symbol )* EOL
globalized_symbol ::= SYMBOL
return_statement ::= RETURN ( expression )? EOL
const_atom_non_minus ::= NIL | UNB | TRUE_TOKEN | FALSE_TOKEN | INTNUM | DBLNUM | STRING
const_atom ::= NIL | UNB | TRUE_TOKEN | FALSE_TOKEN | INTNUM_WITH_MINUS | DBLNUM | STRING
atomic_symbol ::= SYMBOL
var_atom ::= atomic_symbol | SELF | FSELF
OPT_EOL ::= EOL?
expression ::= const_atom_non_minus | var_atom | AMPER SYMBOL | AMPER INTNUM | AMPER SELF | AMPER DOT SYMBOL | AMPER DOT INTNUM | AMPER DOT SELF | MINUS expression | SYMBOL VBAR expression | expression PLUS OPT_EOL expression | expression MINUS OPT_EOL expression | expression STAR OPT_EOL expression | expression SLASH OPT_EOL expression | expression PERCENT OPT_EOL expression | expression POW OPT_EOL expression | expression AMPER_AMPER OPT_EOL expression | expression VBAR_VBAR OPT_EOL expression | expression CAP_CAP OPT_EOL expression | expression SHL OPT_EOL expression | expression SHR OPT_EOL expression | TILDE expression | expression NEQ expression | expression INCREMENT | INCREMENT expression | expression DECREMENT | DECREMENT expression | expression EEQ expression | expression OP_EXEQ expression | expression GT expression | expression LT expression | expression GE expression | expression LE expression | expression AND expression | expression OR expression | NOT expression | expression OP_IN expression | expression OP_NOTIN expression | expression PROVIDES SYMBOL | DOLLAR atomic_symbol | DOLLAR INTNUM | ATSIGN expression | DIESIS expression | CAP_EVAL expression | CAP_OOB expression | CAP_DEOOB expression | CAP_ISOOB expression | CAP_XOROOB expression | nameless_func | nameless_block | innerfunc | func_call | iif_expr | dotarray_decl | expression range_decl | array_decl | expression OPENSQUARE expression CLOSESQUARE | expression OPENSQUARE STAR expression CLOSESQUARE | expression DOT SYMBOL | dict_decl | range_decl | expression OP_EQ expression | expression OP_EQ expression COMMA expression_list | expression ASSIGN_ADD expression | expression ASSIGN_SUB expression | expression ASSIGN_MUL expression | expression ASSIGN_DIV expression | expression ASSIGN_MOD expression | expression ASSIGN_POW expression | expression ASSIGN_BAND expression | expression ASSIGN_BOR expression | expression ASSIGN_BXOR expression | expression ASSIGN_SHL expression | expression ASSIGN_SHR expression | OPENPAR expression CLOSEPAR
range_decl ::= OPENSQUARE ( COLON expression? | expression COLON ( expression ( COLON expression )? )? ) CLOSESQUARE
func_call ::= expression OPENPAR ( expression_list )? CLOSEPAR
nameless_func ::= FUNCDECL nameless_func_decl_inner static_block statement_list END
nameless_block ::= OPEN_GRAPH nameless_block_decl_inner static_block statement_list CLOSE_GRAPH
nameless_func_decl_inner ::= OPENPAR param_list CLOSEPAR EOL
nameless_block_decl_inner ::= param_list ARROW
innerfunc ::= INNERFUNC nameless_func_decl_inner static_block statement_list END
iif_expr ::= expression QUESTION expression COLON expression
array_decl ::= OPENSQUARE ( CLOSESQUARE | expression_list CLOSESQUARE )
dotarray_decl ::= LISTPAR ( CLOSESQUARE | listpar_expression_list ( CLOSESQUARE ) )
dict_decl ::= OPENSQUARE ( ARROW | expression_pair_list ) CLOSESQUARE
expression_list ::= expression ( COMMA expression )*
listpar_expression_list ::= expression ( listpar_comma expression )*
listpar_comma ::= COMMA?
symbol_list ::= atomic_symbol ( COMMA atomic_symbol )*
expression_pair_list ::= expression ARROW expression ( COMMA expression ARROW expression )*
end_of_grammar ::= ""