casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ds9lex.h
Go to the documentation of this file.
1 #ifndef DISPLAY_DS9_DS9LEX_H_
2 #define DISPLAY_DS9_DS9LEX_H_
3 
4 // Flex expects the signature of yylex to be defined in the macro YY_DECL, and
5 // the C++ parser expects it to be declared. We can factor both as follows.
6 #ifndef YY_DECL
7 
8 #define YY_DECL \
9  casa::viewer::ds9parse::token_type \
10  casa::viewer::ds9lex::lex( casa::viewer::ds9parse::semantic_type* yylval, \
11  casa::viewer::ds9parse::location_type* /*yylloc*/ \
12  )
13 #endif
14 
15 // including without guard results in yyFlexLexer being multiply defined when
16 // compiling the scanner...
17 #ifndef __FLEX_LEXER_H
18 #define yyFlexLexer ds9lex_FlexLexer
20 #undef yyFlexLexer
21 #endif
22 
23 #include <display/ds9/ds9context.h>
24 #include <display/ds9/ds9parse.hh>
25 
26 namespace casa {
27  namespace viewer {
28 
29  class Region;
30 
31  // Scanner is a derived class to add some extra function to the scanner
32  // class. Flex itself creates a class named yyFlexLexer, which is renamed using
33  // macros to ds9lex_FlexLexer. However we change the context of the generated
34  // yylex() function to be contained within the ds9lex class. This is required
35  // because the yylex() defined in ds9lex_display/ds9/ds9FlexLexer.has no parameters. */
36  class ds9lex : public ds9lex_FlexLexer {
37  public:
38  // Create a new scanner object. The streams arg_yyin and arg_yyout default
39  // to cin and cout, but that assignment is only made when initializing in
40  // yylex().
41  ds9lex( std::istream* yyin=0, std::ostream* yyout=0 ) : ds9lex_FlexLexer( yyin, yyout ) { }
42  ~ds9lex( ) { }
43 
44  // This is the main lexing function. It is generated by flex according to
45  // the macro declaration YY_DECL above. The generated bison parser then
46  // calls this virtual function to fetch new tokens.
47  virtual ds9parse::token_type lex( ds9parse::semantic_type* yylval, ds9parse::location_type* /*yylloc*/ );
48 
49  void begin(int,int);
50 
51  // Enable debug output (via arg_yyout) if compiled into the scanner.
52  void set_debug(bool b);
53 
54  void discard( int );
55  };
56  }
57 }
58 
59 
60 class CallBack {
61 public:
68  };
69 };
70 
71 class Marker {
72 public:
73  // Select-- user may select the marker
74  // Highlite-- user may highlite the marker
75  // Edit-- user may edit the marker
76  // Move-- user may move the marker
77  // Rotate-- user may rotate the marker
78  // Delete-- user may delete the marker
79  // Fixed-- marker is fixed in size (not scaled based on zoom)
80  // Include-- marker is 'included' or 'excluded' ie '+' or '-'
81  // Source-- marker is a 'source' or 'background' marker
82  // Dash-- render with dashed line
83  enum Property { NONE=0, SELECT=1, HIGHLITE=2, EDIT=4, MOVE=8, ROTATE=16,
84  DELETE=32, FIXED=64, INCLUDE=128, SOURCE=256, DASH=512
85  };
86 };
87 
88 
89 typedef std::list<casa::viewer::Region*> bison_region_list;
90 #endif
void set_debug(bool b)
Enable debug output (via arg_yyout) if compiled into the scanner.
virtual ds9parse::token_type lex(ds9parse::semantic_type *yylval, ds9parse::location_type *)
This is the main lexing function.
Definition: ds9lex.h:71
Scanner is a derived class to add some extra function to the scanner class.
Definition: ds9lex.h:36
Property
Select– user may select the marker Highlite– user may highlite the marker Edit– user may edit the mar...
Definition: ds9lex.h:83
void begin(int, int)
std::list< casa::viewer::Region * > bison_region_list
Definition: ds9lex.h:89
ds9lex(std::istream *yyin=0, std::ostream *yyout=0)
Create a new scanner object.
Definition: ds9lex.h:41