tree: drop last paragraph of GPL copyright header
[coreboot.git] / util / sconfig / sconfig.l
blob1ce616c43a6ff924eddb7d498e3e5e35c760e9be
1 %{
2 /*
3  * sconfig, coreboot device tree compiler
4  *
5  * Copyright (C) 2010 coresystems GmbH
6  *                 written by Patrick Georgi <patrick.georgi@coresystems.de>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  */
18 #include "sconfig.tab.h"
20 int linenum = 0;
22 %option nodebug
24 [ \t]+          {}
25 #.*\n           {linenum++;}
26 \r?\n           {linenum++;}
27 chip            {return(CHIP);}
28 device          {return(DEVICE);}
29 register        {return(REGISTER);}
30 on              {yylval.number=1; return(BOOL);}
31 off             {yylval.number=0; return(BOOL);}
32 pci             {yylval.number=PCI; return(BUS);}
33 ioapic          {yylval.number=IOAPIC; return(BUS);}
34 pnp             {yylval.number=PNP; return(BUS);}
35 i2c             {yylval.number=I2C; return(BUS);}
36 lapic           {yylval.number=APIC; return(BUS);}
37 cpu_cluster     {yylval.number=CPU_CLUSTER; return(BUS);}
38 cpu             {yylval.number=CPU; return(BUS);}
39 domain          {yylval.number=DOMAIN; return(BUS);}
40 irq             {yylval.number=IRQ; return(RESOURCE);}
41 drq             {yylval.number=DRQ; return(RESOURCE);}
42 io              {yylval.number=IO; return(RESOURCE);}
43 ioapic_irq      {return(IOAPIC_IRQ);}
44 inherit         {return(INHERIT);}
45 subsystemid     {return(SUBSYSTEMID);}
46 end             {return(END);}
47 =               {return(EQUALS);}
48 0x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
49 [0-9.]+         {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
50 [0-9a-fA-F.]+   {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
51 INT[A-D]        {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
52 \"[^\"]+\"      {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
53 [^ \n\t]+       {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}