Mercurial > octave-dspies
comparison src/lex.l @ 3165:e4bbfc196e53
[project @ 1998-04-16 03:01:47 by jwe]
author | jwe |
---|---|
date | Thu, 16 Apr 1998 03:05:03 +0000 |
parents | 61bb314b2c3d |
children | 390d5e396682 |
comparison
equal
deleted
inserted
replaced
3164:45490c020e47 | 3165:e4bbfc196e53 |
---|---|
833 } | 833 } |
834 | 834 |
835 return retval; | 835 return retval; |
836 } | 836 } |
837 | 837 |
838 // Check to see if a character string matches any of the possible axes | |
839 // tags for plots. | |
840 | |
841 static string | |
842 plot_axes_token (const string& s) | |
843 { | |
844 string retval; | |
845 | |
846 static char *plot_axes[] = | |
847 { | |
848 "x1y1", | |
849 "x1y2", | |
850 "x2y1", | |
851 "x2y2", | |
852 0, | |
853 }; | |
854 | |
855 char **tmp = plot_axes; | |
856 while (*tmp) | |
857 { | |
858 if (almost_match (*tmp, s.c_str ())) | |
859 { | |
860 retval = *tmp; | |
861 break; | |
862 } | |
863 | |
864 tmp++; | |
865 } | |
866 | |
867 return retval; | |
868 } | |
869 | |
838 // Check to see if a character string matches any one of the plot | 870 // Check to see if a character string matches any one of the plot |
839 // option keywords. Don't match abbreviations for clear, since that's | 871 // option keywords. Don't match abbreviations for clear, since that's |
840 // not a gnuplot keyword (users will probably only expect to be able | 872 // not a gnuplot keyword (users will probably only expect to be able |
841 // to abbreviate actual gnuplot keywords). | 873 // to abbreviate actual gnuplot keywords). |
842 | 874 |
856 else if (almost_match ("with", t)) | 888 else if (almost_match ("with", t)) |
857 { | 889 { |
858 lexer_flags.in_plot_style = true; | 890 lexer_flags.in_plot_style = true; |
859 return WITH; | 891 return WITH; |
860 } | 892 } |
893 else if (almost_match ("axes", t) || almost_match ("axis", t)) | |
894 { | |
895 lexer_flags.in_plot_axes = true; | |
896 return AXES; | |
897 } | |
861 else if (strcmp ("clear", t) == 0) | 898 else if (strcmp ("clear", t) == 0) |
862 { | 899 { |
863 return CLEAR; | 900 return CLEAR; |
864 } | 901 } |
865 else | 902 else |
871 // Handle keywords. | 908 // Handle keywords. |
872 | 909 |
873 static int | 910 static int |
874 is_keyword (const string& s) | 911 is_keyword (const string& s) |
875 { | 912 { |
876 if (lexer_flags.plotting && lexer_flags.in_plot_style) | 913 if (lexer_flags.plotting) |
877 { | 914 { |
878 string sty = plot_style_token (s); | 915 if (lexer_flags.in_plot_style) |
879 | 916 { |
880 if (! sty.empty ()) | 917 string sty = plot_style_token (s); |
881 { | 918 |
882 lexer_flags.in_plot_style = false; | 919 if (! sty.empty ()) |
883 yylval.tok_val = new token (sty); | 920 { |
884 token_stack.push (yylval.tok_val); | 921 lexer_flags.in_plot_style = false; |
885 return STYLE; | 922 yylval.tok_val = new token (sty); |
923 token_stack.push (yylval.tok_val); | |
924 return STYLE; | |
925 } | |
886 } | 926 } |
927 else if (lexer_flags.in_plot_axes) | |
928 { | |
929 string axes = plot_axes_token (s); | |
930 | |
931 if (! axes.empty ()) | |
932 { | |
933 lexer_flags.in_plot_axes = false; | |
934 yylval.tok_val = new token (axes); | |
935 token_stack.push (yylval.tok_val); | |
936 return AXES_TAG; | |
937 } | |
938 } | |
887 } | 939 } |
888 | 940 |
889 int l = input_line_number; | 941 int l = input_line_number; |
890 int c = current_input_column; | 942 int c = current_input_column; |
891 | 943 |
1858 | 1910 |
1859 // Not initially doing any plotting or setting of plot attributes. | 1911 // Not initially doing any plotting or setting of plot attributes. |
1860 doing_set = false; | 1912 doing_set = false; |
1861 in_plot_range = false; | 1913 in_plot_range = false; |
1862 in_plot_style = false; | 1914 in_plot_style = false; |
1915 in_plot_axes = false; | |
1863 in_plot_using = false; | 1916 in_plot_using = false; |
1864 past_plot_range = false; | 1917 past_plot_range = false; |
1865 plotting = false; | 1918 plotting = false; |
1866 | 1919 |
1867 // Not initially looking at indirect references. | 1920 // Not initially looking at indirect references. |