[BACK]Return to parse.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_toolkit

Diff for /OpenXM/src/ox_toolkit/parse.c between version 1.15 and 1.16

version 1.15, 2004/12/01 17:32:26 version 1.16, 2005/07/20 17:48:03
Line 1 
Line 1 
 /* -*- mode: C; coding: euc-japan -*- */  /* -*- mode: C; coding: euc-japan -*- */
 /* $OpenXM: OpenXM/src/ox_toolkit/parse.c,v 1.14 2003/06/02 10:25:57 ohara Exp $ */  /* $OpenXM: OpenXM/src/ox_toolkit/parse.c,v 1.15 2004/12/01 17:32:26 ohara Exp $ */
   
 /*  /*
    This module is a parser for OX/CMO expressions.     This module is a parser for OX/CMO expressions.
Line 48  static union{
Line 48  static union{
 static int pflag_cmo_addrev = 1;  static int pflag_cmo_addrev = 1;
   
 /* definitions of local functions */  /* definitions of local functions */
   static void  init_parser(char *s);
   static cmo  *parse();
 static void parse_error(char *s);  static void parse_error(char *s);
 static void parse_right_parenthesis();  static void parse_right_parenthesis();
 static void parse_left_parenthesis();  static void parse_left_parenthesis();
Line 76  static ox   *parse_ox_data();
Line 78  static ox   *parse_ox_data();
 static void init_lex(char *s);  static void init_lex(char *s);
 static int  lex();  static int  lex();
   
   /* Parsing a Lisp-style expression of CMO. */
   cmo *ox_parse_lisp(char *s)
   {
       return (s != NULL && strlen(s) > 0)? init_parser(s), parse(): NULL;
   }
   
 static int is_token_cmo(int token)  static int is_token_cmo(int token)
 {  {
Line 101  static void parse_error(char *s)
Line 108  static void parse_error(char *s)
     longjmp(env_parse, 1);      longjmp(env_parse, 1);
 }  }
   
 void setflag_parse(int flag)  static void setflag_parse(int flag)
 {  {
     pflag_cmo_addrev = flag;      pflag_cmo_addrev = flag;
 }  }
   
 void init_parser(char *s)  static void init_parser(char *s)
 {  {
     setflag_parse(PFLAG_ADDREV);      setflag_parse(PFLAG_ADDREV);
     init_lex(s);      init_lex(s);
 }  }
   
 cmo *parse()  static cmo *parse()
 {  {
     cmo *m;      cmo *m = NULL;
       if (setjmp(env_parse) == 0) {
     if (setjmp(env_parse) != 0) {  
         return NULL;  
         /* This is an error. */  
     }  
   
     token = lex();  
     if (token == '(') {  
         token = lex();          token = lex();
         if (is_token_cmo(token)) {          if (token == '(') {
             m = parse_cmo();              token = lex();
         }else if(is_token_ox(token)) {              if (is_token_cmo(token)) {
             m = parse_ox();                  m = parse_cmo();
         }else {              }else if(is_token_ox(token)) {
             parse_error("invalid symbol.");                  m = parse_ox();
               }else {
                   parse_error("invalid symbol.");
               }
         }          }
         return m;  
     }      }
     return NULL;      return m;
 }  }
   
 static ox *parse_ox()  static ox *parse_ox()

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>