diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-02-26 20:45:03 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-02-26 20:45:03 (GMT) |
commit | 4900ffe9ac1047f62392e8479f7b6720151836e2 (patch) | |
tree | 1105016944330c98609a99118b8f3213c45c5b1d /ds9/parsers/preservelex.tcl | |
parent | 68a527dba2de1ab4389a9b524bb8f0af9c8c7c25 (diff) | |
download | blt-4900ffe9ac1047f62392e8479f7b6720151836e2.zip blt-4900ffe9ac1047f62392e8479f7b6720151836e2.tar.gz blt-4900ffe9ac1047f62392e8479f7b6720151836e2.tar.bz2 |
add preserve scale
Diffstat (limited to 'ds9/parsers/preservelex.tcl')
-rw-r--r-- | ds9/parsers/preservelex.tcl | 77 |
1 files changed, 44 insertions, 33 deletions
diff --git a/ds9/parsers/preservelex.tcl b/ds9/parsers/preservelex.tcl index 8dcde26..5067af3 100644 --- a/ds9/parsers/preservelex.tcl +++ b/ds9/parsers/preservelex.tcl @@ -188,6 +188,7 @@ set FALSE_ 262 set STRING_ 263 set PAN_ 264 set REGIONS_ 265 +set SCALE_ 266 while {1} { if {[string length $yy_current_buffer] - $index_ < 1024} { @@ -223,90 +224,97 @@ set REGIONS_ 265 set yyleng [string length $yytext] set matched_rule 1 } - # rule 2: yes - if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + # rule 2: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $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: no - if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + # rule 3: 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 3 } - # rule 4: on - if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + # rule 4: 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 4 } - # rule 5: off - if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + # rule 5: 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 5 } - # rule 6: true - if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + # rule 6: 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 6 } - # rule 7: false - if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + # rule 7: 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 7 } - # rule 8: \"[^\"]*\" - if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + # rule 8: 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 8 } - # rule 9: \'[^\']*\' - if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + # rule 9: \"[^\"]*\" + 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 9 } - # rule 10: \{[^\}]*\} - if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + # rule 10: \'[^\']*\' + 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 10 } - # rule 11: \S+\S+ - if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + # rule 11: \{[^\}]*\} + 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 11 } - # rule 12: \s - if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + # rule 12: \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 12 } - # rule 13: . - if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + # rule 13: \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 13 } + # 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 + } if {$matched_rule == -1} { set yytext [string index $yy_current_buffer $index_] set yyleng 1 @@ -326,25 +334,25 @@ return $PAN_ return $REGIONS_ } 2 { -return $YES_ +return $SCALE_ } 3 { -return $NO_ +return $YES_ } 4 { -return $ON_ +return $NO_ } 5 { -return $OFF_ +return $ON_ } 6 { -return $TRUE_ +return $OFF_ } 7 { -return $FALSE_ +return $TRUE_ } 8 { -set yylval [string range $yytext 1 end-1]; return $STRING_ +return $FALSE_ } 9 { set yylval [string range $yytext 1 end-1]; return $STRING_ @@ -353,12 +361,15 @@ set yylval [string range $yytext 1 end-1]; return $STRING_ set yylval [string range $yytext 1 end-1]; return $STRING_ } 11 { -set yylval $yytext; return $STRING_ +set yylval [string range $yytext 1 end-1]; return $STRING_ } 12 { -# ignore whitespace +set yylval $yytext; return $STRING_ } 13 { +# ignore whitespace + } + 14 { set yylval $yytext; return $yylval } default |