diff --git a/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml b/LDP/howto/linuxdoc/Lex-YACC-HOWTO.sgml index 7ebe13a0..c5cb1179 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: @@ -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 */; %%