「言語ハッキング方法 ( Hack AIR-Engine! )」の編集履歴(バックアップ)一覧はこちら
言語ハッキング方法 ( Hack AIR-Engine! ) - (2009/01/25 (日) 11:17:08) の1つ前との変更点
追加された行は緑色になります。
削除された行は赤色になります。
** How to hack the ''Reserved Keyword''. (''予約語'')
- Open "parser/flex.l" and seek definition statement which includes the ''Reserved Keyord'' or its ''Alias Name'' you want to change, in the function named chk_rsvdkeywd().
- ファイル "parser/flex.l" を開き、変更したい''予約語''、又は、その''別名''を含む定義文を関数 chk_rsvdkeywd() の中から検索します。
- Example: "elif"
extern int chk_rsvdkeywd(char *str){
...
if( strcmp(str,"elif")==0 ){ _f("[ELIF]",0); return(ELIF); }
...
}
> Each token in AIR-Script Program is extracted and passed to this function, chk_rsvdkeywd(), to check whether it is a Reserved Keyword or not. 1st parameter, str, is a string to be checked.
> Function _f() is a debug function in flex scanner. It displays debug message with line number if "-f" option is given to AIR-Engine. So you can just ignore it.
> ELIF is a termnal symbol defined in bison parser. It will be reduced to if_stmt non terminal symbol, if correct 'if' statement comes in.
** Example: Change Keyword from "elif" to "elseif"
extern int chk_rsvdkeywd(char *str){
...
//if( strcmp(str,"elif")==0 ){ _f("[ELIF]",0); return(ELIF); }
if( strcmp(str,"elseif")==0 ){ _f("[ELIF]",0); return(ELIF); }
...
}
** Example: Define "elseif" as Alias Name for "elif"
extern int chk_rsvdkeywd(char *str){
...
if( strcmp(str,"elif")==0 ){ _f("[ELIF]",0); return(ELIF); }
if( strcmp(str,"elseif")==0 ){ _f("[ELIF]",0); return(ELIF); }
...
}
** Example: Remove Keyword of "elif"
extern int chk_rsvdkeywd(char *str){
...
if( strcmp(str,"(N/A)")==0 ){ _f("[ELIF]",0); return(ELIF); }
...
}
> Identifier of "(N/A)" cannot be a valid token in AIR-Lang, so it will never passed to this function. Or you can remove this line completely.
* How to hack ''Built-In Function''. (''組み込み関数'')
- Open file "admin/inst_sysfunc.c" and seek definition statement
for Built-In Function Name.
- ソースファイル "admin/inst_sysfunc.c" を開き、変更したい組み込み
関数名の定義文を検索します。
Example: ''dbl()''
wr_dtab(GL_DTAB,"dbl",'X',i_dbl,1);
# GL_DTAB = This identifier has global scope.
# "dbl" = Identifier Name.
# 'X' = This identifier is Built-In Function.
# i_dbl = Internal function name for this identifier.
# 1 = ARGC fot this function.
-[en] Change the string "dbl" in this example.
If you want to define ''Alias Name'' for it, define the same
definition statement with different ''Identifer Name''.
Then recompile AIR.
-[jp] 上記の例では "dbl" の箇所を変更して下さい。
もし、別名を定義する場合は、同様の定義文を異なる識別子を用いて行ってください。
そして、AIRを再コンパイルして下さい。
Example: Alias for ''dbl()''
wr_dtab(GL_DTAB,"double",'X',i_dbl,1);
*** FYI (参考) [#m00b6574]
-[en] If you want to change its internal behavior,
seek "i_dbl.c" in "icode/*" and modify it for you.
-[jp] もし、その内部動作を変更したい場合は、
"icode/*" 中から "i_dbl.c" を探し、その内容を変更してください。
** How to customize ''Colon Command''. (''コロンコマン''のカスタマイズ方法) [#s8e6d247]
*** Procedure (手順) [#kb50c6ae]
-[en] Open file "parser/flex.l" and seek Regular Expression Pattern
of scanner.
-[jp] ソースファイル parser/flex.l を開き、スキャナの正規表現パターン
を検索します。
Example:
^:f(lex)?[ \t;]*(#.*)?\n
-[en] Change the Regular Expression "f(lex)" in this example.
Then recompile AIR.
-[jp] 上記の例では、正規表現 "f(lex)" の箇所を変更して下さい。
そして、AIRを再コンパイルして下さい。
** How to hack the ''Reserved Keyword''. (''予約語'')
- Open "parser/flex.l" and seek definition statement which includes the ''Reserved Keyord'' or its ''Alias Name'' you want to change, in the function named chk_rsvdkeywd().
- ファイル "parser/flex.l" を開き、変更したい''予約語''、又は、その''別名''を含む定義文を関数 chk_rsvdkeywd() の中から検索します。
Example: "elif"
extern int chk_rsvdkeywd(char *str){
...
if( strcmp(str,"elif")==0 ){ _f("[ELIF]",0); return(ELIF); }
...
}
> Each token in AIR-Script Program is extracted and passed to this function, chk_rsvdkeywd(), to check whether it is a Reserved Keyword or not. 1st parameter, str, is a string to be checked.
> Function _f() is a debug function in flex scanner. It displays debug message with line number if "-f" option is given to AIR-Engine. So you can just ignore it.
> ELIF is a termnal symbol defined in bison parser. It will be reduced to if_stmt non terminal symbol, if correct 'if' statement comes in.
** Example: Change Keyword from "elif" to "elseif"
extern int chk_rsvdkeywd(char *str){
...
//if( strcmp(str,"elif")==0 ){ _f("[ELIF]",0); return(ELIF); }
if( strcmp(str,"elseif")==0 ){ _f("[ELIF]",0); return(ELIF); }
...
}
** Example: Define "elseif" as Alias Name for "elif"
extern int chk_rsvdkeywd(char *str){
...
if( strcmp(str,"elif")==0 ){ _f("[ELIF]",0); return(ELIF); }
if( strcmp(str,"elseif")==0 ){ _f("[ELIF]",0); return(ELIF); }
...
}
** Example: Remove Keyword of "elif"
extern int chk_rsvdkeywd(char *str){
...
if( strcmp(str,"(N/A)")==0 ){ _f("[ELIF]",0); return(ELIF); }
...
}
> Identifier of "(N/A)" cannot be a valid token in AIR-Lang, so it will never passed to this function. Or you can remove this line completely.
* How to hack ''Built-In Function''. (''組み込み関数'')
- Open file "admin/inst_sysfunc.c" and seek definition statement
for Built-In Function Name.
- ソースファイル "admin/inst_sysfunc.c" を開き、変更したい組み込み
関数名の定義文を検索します。
Example: ''dbl()''
wr_dtab(GL_DTAB,"dbl",'X',i_dbl,1);
# GL_DTAB = This identifier has global scope.
# "dbl" = Identifier Name.
# 'X' = This identifier is Built-In Function.
# i_dbl = Internal function name for this identifier.
# 1 = ARGC fot this function.
-[en] Change the string "dbl" in this example.
If you want to define ''Alias Name'' for it, define the same
definition statement with different ''Identifer Name''.
Then recompile AIR.
-[jp] 上記の例では "dbl" の箇所を変更して下さい。
もし、別名を定義する場合は、同様の定義文を異なる識別子を用いて行ってください。
そして、AIRを再コンパイルして下さい。
Example: Alias for ''dbl()''
wr_dtab(GL_DTAB,"double",'X',i_dbl,1);
*** FYI (参考) [#m00b6574]
-[en] If you want to change its internal behavior,
seek "i_dbl.c" in "icode/*" and modify it for you.
-[jp] もし、その内部動作を変更したい場合は、
"icode/*" 中から "i_dbl.c" を探し、その内容を変更してください。
** How to customize ''Colon Command''. (''コロンコマン''のカスタマイズ方法) [#s8e6d247]
*** Procedure (手順) [#kb50c6ae]
-[en] Open file "parser/flex.l" and seek Regular Expression Pattern
of scanner.
-[jp] ソースファイル parser/flex.l を開き、スキャナの正規表現パターン
を検索します。
Example:
^:f(lex)?[ \t;]*(#.*)?\n
-[en] Change the Regular Expression "f(lex)" in this example.
Then recompile AIR.
-[jp] 上記の例では、正規表現 "f(lex)" の箇所を変更して下さい。
そして、AIRを再コンパイルして下さい。
表示オプション
横に並べて表示:
変化行の前後のみ表示: