Changeset 520
- Timestamp:
- 01/31/09 15:15:37 (3 years ago)
- Location:
- interpreter/trunk
- Files:
-
- 2 added
- 7 edited
-
ChangeLog (modified) (1 diff)
-
docs/kite-language.texi (modified) (1 diff)
-
modules/System/regex.kt (modified) (1 diff)
-
tests/Makefile.am (modified) (1 diff)
-
tests/objs/loader/loader_notfound.kt (modified) (1 diff)
-
tests/objs/regex/regex_syntax.kt (added)
-
tests/objs/regex/regex_syntax.kt.out (added)
-
vm/kite_lexer.l (modified) (3 diffs)
-
vm/kite_parser.y (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
interpreter/trunk/ChangeLog
r513 r520 1 1/31/2009: 2 * Regular expressions can be specified with "r/.../[i]" syntax (ticket #79) 3 4 1/30/2009: 5 * Compile errors/warnings fixed when compiling with GCC 4.2. (ticket #82) 6 * Fixed infinite loop during string|split with an empty-string delimiter. (ticket #80) 7 * Fixed capture issue in the regular expression engine when using '?' next to parenthesis (ticket #81) 8 1 9 1/29/2009: 2 10 * System.digest merged into main tree (thanks to Michael J. Edgar). 3 11 * System.list|sort method added (credit: Michael J. Edgar). 4 12 5 13 1/1/2009: 6 14 * 1.0.0 released. -
interpreter/trunk/docs/kite-language.texi
r517 r520 88 88 System.math.range object (see kdoc documentation) that represents all the 89 89 numbers from one integer to another (possibly skipping numbers along the way). 90 91 Regular expressions are also built-into the language syntax as of 1.0.1. Regular 92 expressions begin with "r/" and end with either "/" (case-sensitive) or "/i" 93 (case-insensitive). This is equivalent to creating a new System.regex object 94 with the appropriate parameters. 90 95 91 96 @node Declarations -
interpreter/trunk/modules/System/regex.kt
r415 r520 42 42 ]; 43 43 44 construct( 45 regex /[Regular expression to use.]/, 46 c_insensitive /[Case insensitivity on/off]/ 47 ) /[Construct new regular expression object.]/ 48 [ 49 this.internal_regex_obj = make __internal._regex(regex); 50 this.case_insensitive = c_insensitive; 51 ]; 52 44 53 method match( 45 54 str /[String to search.]/ -
interpreter/trunk/tests/Makefile.am
r515 r520 256 256 ./objs/regex/regex_boundary.kt \ 257 257 ./objs/regex/regex_boundary.kt.out \ 258 ./objs/regex/regex_syntax.kt \ 259 ./objs/regex/regex_syntax.kt.out \ 258 260 ./objs/base64/base64_encode.kt \ 259 261 ./objs/base64/base64_encode.kt.out \ -
interpreter/trunk/tests/objs/loader/loader_notfound.kt
r208 r520 1 1 import "System.vm.loader"; 2 2 run [ 3 System.vm.loader|loadClass(" System.exceptions.TypeMismatch2");3 System.vm.loader|loadClass("Kite.ThisClassDoesNotExist"); 4 4 ] catch [ 5 5 __exc|str()|print(); -
interpreter/trunk/vm/kite_lexer.l
r491 r520 28 28 %} 29 29 30 %x operator str sym docstr 30 %x operator str sym docstr regex 31 31 %option noyywrap 32 32 %option bison-bridge bison-locations reentrant … … 105 105 false { fillBoth(yyscanner); yylval->intValue = 0; return BOOL_VALUE; } 106 106 107 "r/" { 108 kite_compiler_t *compiler = (kite_compiler_t*)yyextra; 109 fillFirst(yyscanner); 110 BEGIN(regex); 111 compiler->curStr = strdup(""); 112 } 113 107 114 \" { 108 115 kite_compiler_t *compiler = (kite_compiler_t*)yyextra; … … 117 124 BEGIN(docstr); 118 125 compiler->curStr = strdup(""); 126 } 127 128 <regex>[^/]+ { 129 kite_compiler_t *compiler = (kite_compiler_t*)yyextra; 130 APPEND_STRING(yytext); 131 compiler->currentCol += strlen(yytext); 132 } 133 134 <regex>"\\/" { 135 kite_compiler_t *compiler = (kite_compiler_t*)yyextra; 136 APPEND_STRING("/"); 137 compiler->currentCol += strlen(yytext); 138 } 139 140 <regex>"/i" { 141 kite_compiler_t *compiler = (kite_compiler_t*)yyextra; 142 fillLast(yyscanner); 143 BEGIN(INITIAL); 144 yylval->stringValue = compiler->curStr; 145 return REGEX_VALUE_CI; 146 } 147 148 <regex>"/" { 149 kite_compiler_t *compiler = (kite_compiler_t*)yyextra; 150 fillLast(yyscanner); 151 BEGIN(INITIAL); 152 yylval->stringValue = compiler->curStr; 153 return REGEX_VALUE; 119 154 } 120 155 -
interpreter/trunk/vm/kite_parser.y
r507 r520 154 154 %token RETURN 155 155 %token VERSION_KEYWORD 156 %token REGEX_VALUE 157 %token REGEX_VALUE_CI 156 158 157 159 /* Needed since we can't quite lay out the associativity using the rules yet. */ … … 1047 1049 kite_dereference_object(range_class); 1048 1050 kite_dereference_object(range_object); 1051 $<opValue>$ = NULL; 1052 } 1053 | REGEX_VALUE { 1054 kite_compiler_t *compiler = (kite_compiler_t*)yyget_extra(parm); 1055 kite_thread_t *thd = compiler->thd; 1056 kite_object_t *param_list = kite_new_list(thd); 1057 kite_object_t *regex_obj = kite_dereference_and_load(thd, "System.regex"); 1058 1059 kite_append_list(thd, param_list, kite_new_string(thd, $<stringValue>1)); 1060 1061 COMPILE_INSTRUCTION(kite_compile_push(regex_obj), @1.first_line); 1062 COMPILE_INSTRUCTION(kite_compile_push(param_list), @1.first_line); 1063 COMPILE_INSTRUCTION(kite_compile_make(), @1.first_line); 1064 1065 free($<stringValue>1); 1066 $<opValue>$ = NULL; 1067 } 1068 | REGEX_VALUE_CI { 1069 kite_compiler_t *compiler = (kite_compiler_t*)yyget_extra(parm); 1070 kite_thread_t *thd = compiler->thd; 1071 kite_object_t *param_list = kite_new_list(thd); 1072 kite_object_t *regex_obj = kite_dereference_and_load(thd, "System.regex"); 1073 1074 kite_append_list(thd, param_list, kite_new_string(thd, $<stringValue>1)); 1075 kite_append_list(thd, param_list, kite_new_boolean(thd, TRUE)); 1076 1077 COMPILE_INSTRUCTION(kite_compile_push(regex_obj), @1.first_line); 1078 COMPILE_INSTRUCTION(kite_compile_push(param_list), @1.first_line); 1079 COMPILE_INSTRUCTION(kite_compile_make(), @1.first_line); 1080 1081 free($<stringValue>1); 1049 1082 $<opValue>$ = NULL; 1050 1083 }
Note: See TracChangeset
for help on using the changeset viewer.
