Plan 9 from Bell Labs’s /usr/web/sources/contrib/de0u/root/sys/src/cmd/divergefs/config.l

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


%{

#include <fcall.h>
#include <thread.h>
#include <9p.h>
#include "y.tab.h"
#include "common.h"
#include "debug.h"
#include "configyacclex.h"

extern YYSTYPE yylval;

#define DEBUG_LEX false

%}

%%
[-_a-z]+ {
  NOISE(DEBUG_LEX, "yylex got word: %s", yytext);

  yylval = estrdup_fs(yytext);
  return TOKEN_WORD;
}

\<([^>]|\\>)*\> {
  yylval = estrdup_fs(yytext + 1); /* get rid of < */
  yylval[strlen(yylval) - 1] = '\0'; /* get rid of > */

  NOISE(DEBUG_LEX, "yylex got setting: %s", yylval);
  return TOKEN_SETTING;
}

\/?([-_a-zA-Z0-9.]|\\.)+(\/([-_a-zA-Z0-9.]|\\.)+)* {
  NOISE(DEBUG_LEX, "yylex got path: %s", yytext);
  yylval = estrdup_fs(yytext);
  return TOKEN_PATH;
}

\( {
  NOISE(DEBUG_LEX, "yylex got (");
  return TOKEN_LPAREN;
}

\) {
  NOISE(DEBUG_LEX, "yylex got )");
  return TOKEN_RPAREN;
}



\|\| {
  NOISE(DEBUG_LEX, "yylex got or");
  return TOKEN_OR;
}

&& {
  NOISE(DEBUG_LEX, "yylex got and");
  return TOKEN_AND;
}

\\\n {
  NOISE(DEBUG_LEX, "yylex got line continuation");
}

#([^\n]*\\\n)*[^\n]*\n {
  NOISE(DEBUG_LEX, "yylex got comment");
}

# {
  NOISE(DEBUG_LEX, "yylex got pound");
}

\n {
  NOISE(DEBUG_LEX, "yylex got newline");
}

[ \t] {
  NOISE(DEBUG_LEX, "yylex got space or tab");
}

%%

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.