lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The syntax in section 9 of the manual is based on the tokens described
in section 3.1. The tokens in section 9 are either reserved words shown
in bold or literal strings shown quoted. The exception as you have noted
are Name, String, and Number. The words not in bold are non-terminals.

There is indeed no formal grammar for the tokens; the textual description
seems much more useful than regexes.

The whitespace characters are the ones in ASCII, \t, \n, \b, \f, \r, ' ',
ie, those with code 9, 10, 11, 12, 13, and 32.

The program below can help.
--lhf

/*
* ctype.c
* dump lctype table
*/

#include <ctype.h>
#include <stdio.h>
#include "lctype.h"

int main(void)
{
 int c;
 for (c=0; c<256; c++)
 {
  printf("%d\t%c",c,isprint(c)?c:' ');
  printf("\t"); if (lislalpha(c)) printf("lalpha");
  printf("\t"); if (lislalnum(c)) printf("lalnum");
  printf("\t"); if (lisdigit(c)) printf("digit");
  printf("\t"); if (lisxdigit(c)) printf("xdigit");
  printf("\t"); if (lisprint(c)) printf("print");
  printf("\t"); if (lisspace(c)) printf("space");
  printf("\n");
 }
 return 0;
}