Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 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 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #include "sconfig.tab.h" |
| 23 | |
| 24 | int linenum = 0; |
| 25 | %} |
| 26 | %option nodebug |
| 27 | %% |
| 28 | [ \t]+ {} |
| 29 | #.*\n {linenum++;} |
| 30 | \r?\n {linenum++;} |
| 31 | chip {return(CHIP);} |
| 32 | device {return(DEVICE);} |
| 33 | register {return(REGISTER);} |
| 34 | on {yylval.number=1; return(BOOL);} |
| 35 | off {yylval.number=0; return(BOOL);} |
| 36 | pci {yylval.number=PCI; return(BUS);} |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 37 | ioapic {yylval.number=IOAPIC; return(BUS);} |
Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 38 | pnp {yylval.number=PNP; return(BUS);} |
| 39 | i2c {yylval.number=I2C; return(BUS);} |
Patrick Georgi | 8d31368 | 2010-05-05 13:12:42 +0000 | [diff] [blame] | 40 | lapic {yylval.number=APIC; return(BUS);} |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 41 | cpu_cluster {yylval.number=CPU_CLUSTER; return(BUS);} |
Aaron Durbin | ffda804b | 2014-09-03 12:40:15 -0500 | [diff] [blame^] | 42 | cpu {yylval.number=CPU; return(BUS);} |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 43 | domain {yylval.number=DOMAIN; return(BUS);} |
Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 44 | irq {yylval.number=IRQ; return(RESOURCE);} |
| 45 | drq {yylval.number=DRQ; return(RESOURCE);} |
| 46 | io {yylval.number=IO; return(RESOURCE);} |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 47 | ioapic_irq {return(IOAPIC_IRQ);} |
Sven Schnelle | 270a908 | 2011-03-01 19:58:15 +0000 | [diff] [blame] | 48 | inherit {return(INHERIT);} |
| 49 | subsystemid {return(SUBSYSTEMID);} |
Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 50 | end {return(END);} |
| 51 | = {return(EQUALS);} |
| 52 | 0x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
| 53 | [0-9.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
| 54 | [0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 55 | INT[A-D] {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} |
Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 56 | \"[^\"]+\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} |
| 57 | [^ \n\t]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} |
| 58 | %% |