]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Lots of problems removed
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Mar 1999 18:28:37 +0000 (18:28 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Mar 1999 18:28:37 +0000 (18:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@979 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/parser/Makefile
deal.II/doc/parser/dealparse.l
deal.II/doc/parser/dealparse.y

index d94cf515e39ad31ae7cb1a0fb4a8611576c218de..815246a5a979cf6af674132b7dd0fba8352c8178 100644 (file)
@@ -2,7 +2,7 @@ dealparse: lex.yy.c dealparse.tab.c
        g++ -o $@ $^ -lfl
 
 dealparse.tab.h: dealparse.y
-       bison++ -d -t -v $<
+       bison -d -t -v $<
 
 lex.yy.c: dealparse.l dealparse.tab.h
        flex $<
index c6a7d20a9ff96c939cf431cc048ff26c5be55d9a..eb9d17129e89710d65e97eaef39d73979c2edf71 100644 (file)
@@ -22,13 +22,19 @@ INT   [+-]?[0-9]+
 WHITE [ \t\n\f\v]
 CLASS (class)|(struct)|(union)
 ACCESS (public)|(protected)|(private)
-OP \+|\-|\/|\||\^|(==)|(!=)|(<<)|(>>)
+OP \+|\-|\/|\||\^|(==)|(!=)|(<<)|(>>)|(->)
 
 %%
 
+ /* Commentary template arguments for the parser */
 
 "//<"               { return COMTEMP; }
 
+ /* End of declaration section */
+
+\n?"/*"[-* ]*[Ii]nline.* { return ENDOFDECL; }
+
+
 \n?"/*"             { yy_push_state(COMMENT); }
 <COMMENT>.
 <COMMENT>\n
@@ -49,7 +55,7 @@ DeclException[0-9]  { return(DECLEXCEPTION); }
 
  /* Ignore friend declarations so far */
 
-friend[^;]+; {}
+friend[^;]+; { return FRIEND; }
 
  /*** keywords ***/
 
@@ -57,9 +63,13 @@ const    { return CONST; }
 virtual  { return VIRTUAL; }
 operator { return OPERATOR; }
 unsigned { return UNSIGNED; }
+static   { return STATIC; }
+mutable  { return MUTABLE; }
 template { return TEMPLATE; }
 enum     { return ENUM; }
 friend   { return FRIEND; }
+typedef  { return TYPEDEF; }
+typename {}
 
 {CLASS}  { yylval = string(yytext); return CLASS; }
 {ACCESS} { yylval = string(yytext); return ACCESS; }
index 7d3b6357e6e4e34e46de1d2c1cfcc76d7f3e0878..18e7fd0c33b656e2da771401b04292740dea8781 100644 (file)
@@ -21,10 +21,13 @@ void yyerror(const char* s)
 %}
 
 %token CLASS
+%token TYPEDEF
 %token ACCESS
 %token IDENTIFIER
 %token FARG
 %token CONST
+%token STATIC
+%token MUTABLE
 %token VIRTUAL
 %token ENUM
 %token FRIEND
@@ -39,10 +42,12 @@ void yyerror(const char* s)
 %token COMTEMP
 %token DECLEXCEPTION
 %token INLINE
+%token ENDOFDECL
 %%
 
 all:  declaration_list
   | declaration_list INLINE { return 0; }
+  | declaration_list ENDOFDECL { return 0; }
 ;
 
 declaration_list: declaration
@@ -50,12 +55,14 @@ declaration_list: declaration
   | declaration_list ';'
 ;
 
-declaration: class_declaration ';'
+declaration:
+  class_declaration ';'
   | function_declaration ';'
   | function_declaration '{' '}' ';'
   | function_declaration '{' '}'
   | variable_declaration ';'
   | enum_declaration ';'
+  | typedef_declaration ';'
   | template_declaration class_declaration ';'
     { cout << setw(OUTW) << "Template-Description:" << $1 << endl; }
   | template_declaration function_declaration ';'
@@ -67,12 +74,27 @@ variable_declaration:
   vartype identifier
     { cout << setw(OUTW) << "Variable-Declaration:" << $2 << endl
           << setw(OUTW) << "Type:" << $1 << endl
+          << setw(OUTW) << "In-Class:" << class_stack.top() << endl
           << setw(OUTW) << "Access:" << access_stack.top() << endl; }
   | vartype identifier array_dimensions
     { cout << setw(OUTW) << "Variable-Declaration:" << $2 << endl
           << setw(OUTW) << "Type:" << $1 << endl
+          << setw(OUTW) << "In-Class:" << class_stack.top() << endl
           << setw(OUTW) << "Access:" << access_stack.top() << endl
           << setw(OUTW) << "Array-Dimension:" << $3 << endl; }
+  | variable_declaration '=' expression
+;
+
+typedef_declaration:
+    TYPEDEF vartype identifier
+      { cout << setw(OUTW) << "Typedef:" << $3 << endl
+            << setw(OUTW) << "Type:" << $2 << endl
+            << setw(OUTW) << "Access:" << access_stack.top() << endl; }
+    | TYPEDEF vartype identifier array_dimensions
+      { cout << setw(OUTW) << "Typedef:" << $3 << endl
+            << setw(OUTW) << "Type:" << $2 << endl
+            << setw(OUTW) << "Access:" << access_stack.top() << endl
+            << setw(OUTW) << "Array-Dimension:" << $4 << endl; }
 ;
 
 array_dimensions:
@@ -108,9 +130,12 @@ function_name:
   identifier
   | '~' identifier { $$ = string("~") + $2; }
   | OPERATOR operator { $$ = string("operator") + $2; }
+  | OPERATOR vartype { $$ = string("operator") + $2; }
+  
 ;
 
 operator: OP
+  | operator '=' { $$ = $1 + string("="); }
   | '='
   | '&'
   | '*'
@@ -136,11 +161,13 @@ argument:
   | vartype identifier { $$ = $1 + SPC + $2; }
   | vartype identifier '=' default_arg
     { $$ = $1 + SPC + $2 + string(" = ") + $4; }
+  | CLASS IDENTIFIER { $$ = $1 + SPC + $2; }
+  | vartype '(' identifier ')' argument_declaration
+    { $$ = $1 + $2 + $3 + $4 + string(" (") + $5 + string(")"); }
 ;
 
 default_arg:
-    literal
-    | identifier
+  expression
 ;
 
 enum_declaration:
@@ -148,7 +175,8 @@ enum_declaration:
 ;
 
 enum_list: /* empty */
-    |  enum_list ',' enumerator
+    | enumerator
+    |  enum_list ',' enumerator { $$ = $1 + string("@") + $3; }
 ;
 
 enumerator: IDENTIFIER
@@ -210,6 +238,12 @@ member_declaration:
       cout << setw(OUTW) << "Virtual:" << "pure" << endl;
     }
   | ACCESS ':' { access_stack.top() = $1; }
+  | friend_declaration
+;
+
+friend_declaration:
+  FRIEND /* declaration { cout << setw(OUTW) << "Friend:" << endl; } */
+  | TEMPLATE '<' '>' FRIEND /*declaration { cout << setw(OUTW) << "Friend:" << endl; } */
 ;
 
 vartype:
@@ -219,6 +253,8 @@ vartype:
 /*  | vartype CONST { $$ = $1 +  string(" const"); } */
   | vartype '&' { $$ = $1 + string("&"); }
   | vartype '*' { $$ = $1 + string("*"); }
+  | STATIC vartype { $$ = string("static ") + $2; }
+  | MUTABLE vartype { $$ = string("mutable ") + $2; }
 ;
 
 virtualopt: VIRTUAL { $$ = string("virtual"); }
@@ -239,6 +275,7 @@ expression:
   | OP expression { $$ = $1 + $2; }
   | expression OP expression { $$ = $1 + $2 + $3; }
   | expression INT { $$ = $1 + $2; }
+  | identifier argument_declaration { $$ = $1 + $2; }
 ;
 
 literal:
@@ -260,6 +297,7 @@ template_arglist:
 template_arg:
   vartype
   | expression
+  | CLASS IDENTIFIER { $$ = $1 + SPC + $2; }
 ;
 
 template_declaration:
@@ -280,7 +318,7 @@ deal_exception_arg: identifier
 ;
 
 deal_exception_output_declaration: OP
-  | deal_exception_output_declaration IDENTIFIER
+  | deal_exception_output_declaration vartype
   | deal_exception_output_declaration literal
   | deal_exception_output_declaration OP
 ;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.