diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-07-31 16:44:38 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-07-31 16:44:38 (GMT) |
commit | 206e6223447359bb13b59843f4f1ac983ccb1bd8 (patch) | |
tree | 45a497d8ab26e492207d1bdfc210aed996284a8b /ds9/parsers/magnifierlex.tcl | |
parent | 181b2ca19e96b8c77cddfeef756f9564c34148be (diff) | |
download | blt-206e6223447359bb13b59843f4f1ac983ccb1bd8.zip blt-206e6223447359bb13b59843f4f1ac983ccb1bd8.tar.gz blt-206e6223447359bb13b59843f4f1ac983ccb1bd8.tar.bz2 |
update all parsers to accept british spelling of COLOUR
Diffstat (limited to 'ds9/parsers/magnifierlex.tcl')
-rw-r--r-- | ds9/parsers/magnifierlex.tcl | 114 |
1 files changed, 62 insertions, 52 deletions
diff --git a/ds9/parsers/magnifierlex.tcl b/ds9/parsers/magnifierlex.tcl index 70b8f44..ed47616 100644 --- a/ds9/parsers/magnifierlex.tcl +++ b/ds9/parsers/magnifierlex.tcl @@ -220,132 +220,139 @@ set ZOOM_ 269 set yyleng [string length $yytext] set matched_rule 0 } - # rule 1: cursor - if {[regexp -start $index_ -indices -line -nocase -- {\A(cursor)} $yy_current_buffer match] > 0 && \ + # rule 1: colour + if {[regexp -start $index_ -indices -line -nocase -- {\A(colour)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 1 } - # rule 2: region - if {[regexp -start $index_ -indices -line -nocase -- {\A(region)} $yy_current_buffer match] > 0 && \ + # rule 2: cursor + if {[regexp -start $index_ -indices -line -nocase -- {\A(cursor)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 2 } - # rule 3: zoom - if {[regexp -start $index_ -indices -line -nocase -- {\A(zoom)} $yy_current_buffer match] > 0 && \ + # rule 3: region + if {[regexp -start $index_ -indices -line -nocase -- {\A(region)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 3 } - # rule 4: yes - if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + # rule 4: zoom + if {[regexp -start $index_ -indices -line -nocase -- {\A(zoom)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 4 } - # rule 5: no - if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + # rule 5: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 5 } - # rule 6: on - if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + # rule 6: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 6 } - # rule 7: off - if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + # rule 7: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 7 } - # rule 8: true - if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + # rule 8: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 8 } - # rule 9: false - if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + # rule 9: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 9 } - # rule 10: [+-]?{D}+ - if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + # rule 10: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 10 } - # rule 11: [+-]?{D}+\.?({E})? - if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + # rule 11: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 11 } - # rule 12: [+-]?{D}*\.{D}+({E})? - if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + # rule 12: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 12 } - # rule 13: \"[^\"]*\" - if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + # rule 13: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 13 } - # rule 14: \'[^\']*\' - if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + # rule 14: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 14 } - # rule 15: \{[^\}]*\} - if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + # rule 15: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 15 } - # rule 16: \S+\S+ - if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + # rule 16: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 16 } - # rule 17: \s - if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + # rule 17: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 17 } - # rule 18: . - if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + # rule 18: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ [lindex $match 1] - $index_ + 1 > $yyleng} { set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] set yyleng [string length $yytext] set matched_rule 18 } + # rule 19: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } if {$matched_rule == -1} { set yytext [string index $yy_current_buffer $index_] set yyleng 1 @@ -362,41 +369,41 @@ set ZOOM_ 269 return $COLOR_ } 1 { -return $CURSOR_ +return $COLOR_ } 2 { -return $REGION_ +return $CURSOR_ } 3 { -return $ZOOM_ +return $REGION_ } 4 { -return $YES_ +return $ZOOM_ } 5 { -return $NO_ +return $YES_ } 6 { -return $ON_ +return $NO_ } 7 { -return $OFF_ +return $ON_ } 8 { -return $TRUE_ +return $OFF_ } 9 { -return $FALSE_ +return $TRUE_ } 10 { -set yylval $yytext; return $INT_ +return $FALSE_ } - 11 - - 12 { -set yylval $yytext; return $REAL_ + 11 { +set yylval $yytext; return $INT_ } + 12 - 13 { -set yylval [string range $yytext 1 end-1]; return $STRING_ +set yylval $yytext; return $REAL_ } 14 { set yylval [string range $yytext 1 end-1]; return $STRING_ @@ -405,12 +412,15 @@ set yylval [string range $yytext 1 end-1]; return $STRING_ set yylval [string range $yytext 1 end-1]; return $STRING_ } 16 { -set yylval $yytext; return $STRING_ +set yylval [string range $yytext 1 end-1]; return $STRING_ } 17 { -# ignore whitespace +set yylval $yytext; return $STRING_ } 18 { +# ignore whitespace + } + 19 { set yylval $yytext; return $yylval } default |