[Olsr-cvs] olsrd-current/src/cfgparser oscan.lex,1.25,1.26

Bernd Petrovitsch (spam-protected)
Fri Oct 5 01:06:12 CEST 2007


Update of /cvsroot/olsrd/olsrd-current/src/cfgparser
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13129/src/cfgparser

Modified Files:
	oscan.lex 
Log Message:
* apparently no one is using hex values in olsrd.conf as the HEXDIGIT
  reg-exp was totally broken.
  fixed  it. And renamed it to HEX8
* renamed HEXBYTE to HEX16 as IPv6 actually has 16bit values there (and
  byte is misleading)
* rearranged the regexps to look more similar. Since flex (and lex) generate
  DEAs out of it, it doesn't make a difference.
* use "size_t".
* use more options: I don't know if that breaks on *BSD.


Index: oscan.lex
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/cfgparser/oscan.lex,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** oscan.lex	13 Sep 2007 16:08:13 -0000	1.25
--- oscan.lex	4 Oct 2007 23:06:10 -0000	1.26
***************
*** 72,76 ****
  
  static struct conf_token *get_conf_token(void);
! static struct conf_token *get_string_token(const char * const s, int const n);
  static struct conf_token *get_integer_token(const char * const s);
  static struct conf_token *get_floating_token(const char * const s);
--- 72,76 ----
  
  static struct conf_token *get_conf_token(void);
! static struct conf_token *get_string_token(const char * const s, const size_t n);
  static struct conf_token *get_integer_token(const char * const s);
  static struct conf_token *get_floating_token(const char * const s);
***************
*** 86,90 ****
  }
  
! static struct conf_token *get_string_token(const char * const s, int const n)
  {
      struct conf_token *rv = get_conf_token();
--- 86,90 ----
  }
  
! static struct conf_token *get_string_token(const char * const s, const size_t n)
  {
      struct conf_token *rv = get_conf_token();
***************
*** 131,152 ****
  %}
  
  %option noyywrap
  
  DECDIGIT [0-9]
  FLOAT {DECDIGIT}+\.{DECDIGIT}+
! HEXDIGIT [a-f][A-F][0-9]
  
! IPV4ADDR ({DECDIGIT}){1,3}\.({DECDIGIT}){1,3}\.({DECDIGIT}){1,3}\.({DECDIGIT}){1,3}
  
! HEXBYTE ([a-f]|[A-F]|[0-9]){1,4}
  
! IP6PAT1 ({HEXBYTE}:){7}{HEXBYTE}
! IP6PAT2 {HEXBYTE}::({HEXBYTE}:){0,5}{HEXBYTE}
! IP6PAT3 ({HEXBYTE}:){2}:({HEXBYTE}:){0,4}{HEXBYTE}
! IP6PAT4 ({HEXBYTE}:){3}:({HEXBYTE}:){0,3}{HEXBYTE}
! IP6PAT5 ({HEXBYTE}:){4}:({HEXBYTE}:){0,2}{HEXBYTE}
! IP6PAT6 ({HEXBYTE}:){5}:({HEXBYTE}:){0,1}{HEXBYTE}
! IP6PAT7 ({HEXBYTE}:){6}:{HEXBYTE}
! IP6PAT8 ({HEXBYTE}:){1,7}:
  IP6PAT9 ::
  
--- 131,157 ----
  %}
  
+ %option never-interactive
+ %option noalways-interactive
+ %option nomain
+ %option nostack
  %option noyywrap
  
  DECDIGIT [0-9]
  FLOAT {DECDIGIT}+\.{DECDIGIT}+
! HEX8 [a-fA-F0-9]
! QUAD {DECDIGIT}{1,3}
  
! IPV4ADDR {QUAD}\.{QUAD}\.{QUAD}\.{QUAD}
  
! HEX16 {HEX8}{1,4}
  
! IP6PAT2 ({HEX16}:){1}:({HEX16}:){0,5}{HEX16}
! IP6PAT3 ({HEX16}:){2}:({HEX16}:){0,4}{HEX16}
! IP6PAT4 ({HEX16}:){3}:({HEX16}:){0,3}{HEX16}
! IP6PAT5 ({HEX16}:){4}:({HEX16}:){0,2}{HEX16}
! IP6PAT6 ({HEX16}:){5}:({HEX16}:){0,1}{HEX16}
! IP6PAT7 ({HEX16}:){6}:({HEX16})
! IP6PAT1 ({HEX16}:){7}{HEX16}
! IP6PAT8 ({HEX16}:){1,7}:
  IP6PAT9 ::
  
***************
*** 178,182 ****
  }
  
! 0x{HEXDIGIT}+ {
      yylval = get_integer_token(yytext);
      return TOK_INTEGER;
--- 183,187 ----
  }
  
! 0x{HEX8}+ {
      yylval = get_integer_token(yytext);
      return TOK_INTEGER;





More information about the Olsr-cvs mailing list