Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 1 | %{ |
Patrick Georgi | ea063cb | 2020-05-08 19:28:13 +0200 | [diff] [blame] | 2 | /* sconfig, coreboot device tree compiler */ |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 3 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 4 | |
| 5 | #include "sconfig.tab.h" |
| 6 | |
| 7 | int linenum = 0; |
| 8 | %} |
| 9 | %option nodebug |
| 10 | %% |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 11 | [ \t]+ {} |
| 12 | #.*\n {linenum++;} |
| 13 | \r?\n {linenum++;} |
| 14 | chip {return(CHIP);} |
| 15 | device {return(DEVICE);} |
| 16 | register {return(REGISTER);} |
| 17 | on {yylval.number=1; return(BOOL);} |
| 18 | off {yylval.number=0; return(BOOL);} |
Ronald G. Minnich | 466ca2c | 2019-10-22 02:02:24 +0000 | [diff] [blame] | 19 | hidden {yylval.number=3; return(STATUS);} |
| 20 | mandatory {yylval.number=5; return(STATUS);} |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 21 | pci {yylval.number=PCI; return(BUS);} |
| 22 | ioapic {yylval.number=IOAPIC; return(BUS);} |
| 23 | pnp {yylval.number=PNP; return(BUS);} |
| 24 | i2c {yylval.number=I2C; return(BUS);} |
| 25 | lapic {yylval.number=APIC; return(BUS);} |
| 26 | cpu_cluster {yylval.number=CPU_CLUSTER; return(BUS);} |
| 27 | cpu {yylval.number=CPU; return(BUS);} |
| 28 | domain {yylval.number=DOMAIN; return(BUS);} |
| 29 | generic {yylval.number=GENERIC; return(BUS);} |
| 30 | mmio {yylval.number=MMIO; return(BUS);} |
| 31 | spi {yylval.number=SPI; return(BUS);} |
| 32 | usb {yylval.number=USB; return(BUS);} |
| 33 | irq {yylval.number=IRQ; return(RESOURCE);} |
| 34 | drq {yylval.number=DRQ; return(RESOURCE);} |
| 35 | io {yylval.number=IO; return(RESOURCE);} |
| 36 | ioapic_irq {return(IOAPIC_IRQ);} |
| 37 | inherit {return(INHERIT);} |
| 38 | subsystemid {return(SUBSYSTEMID);} |
| 39 | end {return(END);} |
| 40 | smbios_slot_desc {return(SLOT_DESC);} |
| 41 | = {return(EQUALS);} |
| 42 | 0x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
| 43 | [0-9.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
| 44 | [0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
| 45 | INT[A-D] {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} |
| 46 | \"\"[^\"]+\"\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} |
| 47 | \"[^\"]+\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} |
| 48 | [^ \n\t]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} |
Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 49 | %% |