diff libinterp/corefcn/oct-tex-lexer.in.ll @ 20573:e3c0fee87493

style fixes for tex lexer and parser * oct-tex-lexer.in.ll, oct-tex-parser.in.yy: Eliminate tabs and reindent.
author John W. Eaton <jwe@octave.org>
date Fri, 02 Oct 2015 12:25:39 -0400
parents a3577622952c
children
line wrap: on
line diff
--- a/libinterp/corefcn/oct-tex-lexer.in.ll	Fri Oct 02 17:48:58 2015 +0200
+++ b/libinterp/corefcn/oct-tex-lexer.in.ll	Fri Oct 02 12:25:39 2015 -0400
@@ -36,8 +36,8 @@
 
 }
 
-%x	NUM_MODE
-%x	MAYBE_NUM_MODE
+%x NUM_MODE
+%x MAYBE_NUM_MODE
 
 %{
 
@@ -53,19 +53,19 @@
 
 // FIXME: with bison 3.x, OCTAVE_TEX_STYPE appears in the generated
 // oct-parse.h file, but there is no definition for YYSTYPE, which is
-// needed by the code that is generated by flex.  I can't seem to find a
-// way to tell flex to use OCTAVE_TEX_STYPE instead of YYSTYPE in the code
-// it generates, or to tell bison to provide the definition of YYSTYPE
-// in the generated oct-parse.h file.
+// needed by the code that is generated by flex.  I can't seem to find
+// a way to tell flex to use OCTAVE_TEX_STYPE instead of YYSTYPE in
+// the code it generates, or to tell bison to provide the definition
+// of YYSTYPE in the generated oct-parse.h file.
 
 #if defined (OCTAVE_TEX_STYPE_IS_DECLARED) && ! defined YYSTYPE
 #define YYSTYPE OCTAVE_TEX_STYPE
 #endif
 
 #if defined (GNULIB_NAMESPACE)
-// Calls to the following functions appear in the generated output from
-// flex without the namespace tag.  Redefine them so we will use them
-// via the gnulib namespace.
+// Calls to the following functions appear in the generated output
+// from flex without the namespace tag.  Redefine them so we will use
+// them via the gnulib namespace.
 #define fprintf GNULIB_NAMESPACE::fprintf
 #define fread GNULIB_NAMESPACE::fread
 #define fwrite GNULIB_NAMESPACE::fwrite
@@ -77,73 +77,99 @@
 
 %}
 
-D       [0-9]
-NUM	(({D}+\.?{D}*)|(\.{D}+))
+D   [0-9]
+NUM (({D}+\.?{D}*)|(\.{D}+))
 
 %%
 
 %{
-// Numeric values
+// Numeric values.
 %}
 
-<NUM_MODE>{NUM}		{
-    int nread;
+<NUM_MODE>{NUM} {
+    int nread = sscanf (yytext, "%lf", &(yylval->num));
 
-    nread = sscanf (yytext, "%lf", &(yylval->num));
     if (nread == 1)
       return NUM;
   }
-<NUM_MODE>[ \t]+	{ }
-<NUM_MODE>"\n"|.	{ yyless (0); BEGIN (INITIAL); }
+
+<NUM_MODE>[ \t]+ { }
+
+<NUM_MODE>"\n"|. {
+    yyless (0);
+    BEGIN (INITIAL);
+  }
 
-<MAYBE_NUM_MODE>"{"	{ BEGIN (NUM_MODE); return START; }
-<MAYBE_NUM_MODE>"\n"|.	{ yyless (0); BEGIN (INITIAL); }
+<MAYBE_NUM_MODE>"{" {
+    BEGIN (NUM_MODE);
+    return START;
+  }
+
+<MAYBE_NUM_MODE>"\n"|. {
+    yyless (0);
+    BEGIN (INITIAL);
+  }
 
 %{
-// Simple commands
+// Simple commands.
 %}
 
-"\\bf"		{ return BF; }
-"\\it"		{ return IT; }
-"\\sl"		{ return SL; }
-"\\rm"		{ return RM; }
+"\\bf" { return BF; }
+"\\it" { return IT; }
+"\\sl" { return SL; }
+"\\rm" { return RM; }
 
 %{
-// Generic font commands
+// Generic font commands.
 %}
 
-"\\fontname"	{ return FONTNAME; }
-"\\fontsize"	{ BEGIN (MAYBE_NUM_MODE); return FONTSIZE; }
-"\\color[rgb]"	{ BEGIN (MAYBE_NUM_MODE); return COLOR_RGB; }
-"\\color"	{ return COLOR; }
+"\\fontname" { return FONTNAME; }
+
+"\\fontsize" {
+    BEGIN (MAYBE_NUM_MODE);
+    return FONTSIZE;
+  }
+
+"\\color[rgb]" {
+    BEGIN (MAYBE_NUM_MODE);
+    return COLOR_RGB;
+  }
+
+"\\color" { return COLOR; }
 
 %{
-// Special characters
+// Special characters.
 %}
 
-"{"	{ return START; }
-"}"	{ return END; }
-"^"	{ return SUPER; }
-"_"	{ return SUB; }
+"{" { return START; }
+"}" { return END; }
+"^" { return SUPER; }
+"_" { return SUB; }
 
-"\\{"	|
-"\\}"	|
-"\\^"	|
-"\\_"	|
-"\\\\"	{ yylval->ch = yytext[1]; return CH; }
+"\\{"  |
+"\\}"  |
+"\\^"  |
+"\\_"  |
+"\\\\" {
+    yylval->ch = yytext[1];
+    return CH;
+  }
 
 %{
-// Symbols
+// Symbols.
 %}
 
 @SYMBOL_RULES@
 
 %{
-// Generic character
+// Generic character.
 %}
 
-"\n"	|
-.	{ yylval->ch = yytext[0]; return CH; }
+"\n" |
+.    {
+    yylval->ch = yytext[0];
+    return CH;
+  }
 
 %%