blob: 4f4084fda007a2d4c4529e95ef6ca110fa702045 [file] [log] [blame]
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +00001%{
2/*
3 * sconfig, coreboot device tree compiler
4 *
5 * Copyright (C) 2010 coresystems GmbH
Stefan Reinauer2e78aa52016-05-07 01:11:14 -07006 * written by Patrick Georgi <patrick@georgi-clan.de>
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +00007 *
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.
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000016 */
17
18#include "sconfig.tab.h"
19
20int linenum = 0;
21%}
22%option nodebug
23%%
24[ \t]+ {}
25#.*\n {linenum++;}
26\r?\n {linenum++;}
27chip {return(CHIP);}
28device {return(DEVICE);}
29register {return(REGISTER);}
30on {yylval.number=1; return(BOOL);}
31off {yylval.number=0; return(BOOL);}
32pci {yylval.number=PCI; return(BUS);}
Sven Schnelle0fa50a12012-06-21 22:19:48 +020033ioapic {yylval.number=IOAPIC; return(BUS);}
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000034pnp {yylval.number=PNP; return(BUS);}
35i2c {yylval.number=I2C; return(BUS);}
Patrick Georgi8d313682010-05-05 13:12:42 +000036lapic {yylval.number=APIC; return(BUS);}
Stefan Reinauer0aa37c42013-02-12 15:20:54 -080037cpu_cluster {yylval.number=CPU_CLUSTER; return(BUS);}
Aaron Durbinffda804b2014-09-03 12:40:15 -050038cpu {yylval.number=CPU; return(BUS);}
Stefan Reinauer4aff4452013-02-12 14:17:15 -080039domain {yylval.number=DOMAIN; return(BUS);}
Duncan Laurie4650f5b2016-05-07 20:01:34 -070040generic {yylval.number=GENERIC; return(BUS);}
Furquan Shaikhe6700292017-02-11 00:50:38 -080041spi {yylval.number=SPI; return(BUS);}
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000042irq {yylval.number=IRQ; return(RESOURCE);}
43drq {yylval.number=DRQ; return(RESOURCE);}
44io {yylval.number=IO; return(RESOURCE);}
Sven Schnelle0fa50a12012-06-21 22:19:48 +020045ioapic_irq {return(IOAPIC_IRQ);}
Sven Schnelle270a9082011-03-01 19:58:15 +000046inherit {return(INHERIT);}
47subsystemid {return(SUBSYSTEMID);}
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000048end {return(END);}
49= {return(EQUALS);}
500x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
51[0-9.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
52[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
Sven Schnelle0fa50a12012-06-21 22:19:48 +020053INT[A-D] {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
Duncan Laurieb1fb0152016-05-07 19:43:25 -070054\"\"[^\"]+\"\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +000055\"[^\"]+\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
56[^ \n\t]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
57%%