From ae86c97ea61879832d533c193895403a6ed49928 Mon Sep 17 00:00:00 2001 From: Chuan Wei Foo Date: Thu, 4 Feb 2021 02:32:31 +0800 Subject: [PATCH 1/2] Fix typos --- LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml b/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml index 7ebe13a0..2152d06c 100644 --- a/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml +++ b/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml @@ -422,7 +422,7 @@ output the message passed, but there are smarter things to do. See the 'Further reading' section at the end. The function yywrap() can be used to continue reading from another file. It -is called at EOF and you can than open another file, and return 0. Or you +is called at EOF and you can then open another file, and return 0. Or you can return 1, indicating that this is truly the end. For more about this, see the 'How do Lex and YACC work internally' chapter. @@ -934,7 +934,7 @@ and integers - but not simultaneously. Remember that we told YACC previously what type yylval was supposed to be by defining YYSTYPE. We could conceivably define YYSTYPE to be a union this -way, by YACC has an easier method for doing this: the %union statement. +way, but YACC has an easier method for doing this: the %union statement. Based on Example 4, we now write the Example 7 YACC grammar. First the intro: @@ -975,7 +975,7 @@ heat return TOKHEAT; on|off yylval.number=!strcmp(yytext,"on"); return STATE; target return TOKTARGET; temperature return TOKTEMPERATURE; -[a-z0-9]+ yylval.string=strdup(yytext);return WORD; +[a-z0-9]+ yylval.string=strdup(yytext); return WORD; \n /* ignore end of line */; [ \t]+ /* ignore whitespace */; %% From aa77fb82d76bbd991b938ef08504a01971e44c84 Mon Sep 17 00:00:00 2001 From: Chuan Wei Foo Date: Thu, 4 Feb 2021 02:39:34 +0800 Subject: [PATCH 2/2] Fix inconsistent use of tabs and spaces --- LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml b/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml index 2152d06c..c5cb1179 100644 --- a/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml +++ b/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml @@ -970,12 +970,12 @@ The Lexer file changes a bit too: %} %% [0-9]+ yylval.number=atoi(yytext); return NUMBER; -heater return TOKHEATER; +heater return TOKHEATER; heat return TOKHEAT; on|off yylval.number=!strcmp(yytext,"on"); return STATE; target return TOKTARGET; temperature return TOKTEMPERATURE; -[a-z0-9]+ yylval.string=strdup(yytext); return WORD; +[a-z0-9]+ yylval.string=strdup(yytext); return WORD; \n /* ignore end of line */; [ \t]+ /* ignore whitespace */; %%