1220604Sjkim%{ 2220604Sjkim/****************************************************************************** 3220604Sjkim * 4220604Sjkim * Module Name: dtparser.l - Flex input file for table compiler lexer 5220604Sjkim * 6220604Sjkim *****************************************************************************/ 7220604Sjkim 8220604Sjkim/* 9281075Sdim * Copyright (C) 2000 - 2015, Intel Corp. 10220604Sjkim * All rights reserved. 11220604Sjkim * 12220604Sjkim * Redistribution and use in source and binary forms, with or without 13220604Sjkim * modification, are permitted provided that the following conditions 14220604Sjkim * are met: 15220604Sjkim * 1. Redistributions of source code must retain the above copyright 16220604Sjkim * notice, this list of conditions, and the following disclaimer, 17220604Sjkim * without modification. 18220604Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 19220604Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 20220604Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 21220604Sjkim * including a substantially similar Disclaimer requirement for further 22220604Sjkim * binary redistribution. 23220604Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 24220604Sjkim * of any contributors may be used to endorse or promote products derived 25220604Sjkim * from this software without specific prior written permission. 26220604Sjkim * 27220604Sjkim * Alternatively, this software may be distributed under the terms of the 28220604Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 29220604Sjkim * Software Foundation. 30220604Sjkim * 31220604Sjkim * NO WARRANTY 32220604Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33220604Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34220604Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 35220604Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36220604Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37220604Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 38220604Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39220604Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 40220604Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 41220604Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42220604Sjkim * POSSIBILITY OF SUCH DAMAGES. 43220604Sjkim */ 44220604Sjkim 45220663Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h> 46220604Sjkim#include "dtparser.y.h" 47220604Sjkim 48220604Sjkim#define YY_NO_INPUT /* No file input, we use strings only */ 49220604Sjkim 50220604Sjkim#define _COMPONENT ACPI_COMPILER 51220604Sjkim ACPI_MODULE_NAME ("dtscanner") 52220604Sjkim%} 53220604Sjkim 54220604Sjkim%option noyywrap 55220604Sjkim%option nounput 56220604Sjkim 57220604SjkimNumber [0-9a-fA-F]+ 58220604SjkimHexNumber 0[xX][0-9a-fA-F]+ 59220604SjkimDecimalNumber 0[dD][0-9]+ 60220604SjkimLabelRef $[a-zA-Z][0-9a-zA-Z]* 61220604SjkimWhiteSpace [ \t\v\r]+ 62220604SjkimNewLine [\n] 63220604Sjkim 64220604Sjkim%% 65220604Sjkim 66220604Sjkim\( return (EXPOP_PAREN_OPEN); 67220604Sjkim\) return (EXPOP_PAREN_CLOSE); 68220604Sjkim\~ return (EXPOP_ONES_COMPLIMENT); 69220604Sjkim\! return (EXPOP_LOGICAL_NOT); 70220604Sjkim\* return (EXPOP_MULTIPLY); 71220604Sjkim\/ return (EXPOP_DIVIDE); 72220604Sjkim\% return (EXPOP_MODULO); 73220604Sjkim\+ return (EXPOP_ADD); 74220604Sjkim\- return (EXPOP_SUBTRACT); 75220604Sjkim">>" return (EXPOP_SHIFT_RIGHT); 76220604Sjkim"<<" return (EXPOP_SHIFT_LEFT); 77220604Sjkim\< return (EXPOP_LESS); 78220604Sjkim\> return (EXPOP_GREATER); 79220604Sjkim"<=" return (EXPOP_LESS_EQUAL); 80220604Sjkim">=" return (EXPOP_GREATER_EQUAL); 81220604Sjkim"==" return (EXPOP_EQUAL); 82220604Sjkim"!=" return (EXPOP_NOT_EQUAL); 83220604Sjkim\& return (EXPOP_AND); 84220604Sjkim\^ return (EXPOP_XOR); 85220604Sjkim\| return (EXPOP_OR); 86220604Sjkim"&&" return (EXPOP_LOGICAL_AND); 87220604Sjkim"||" return (EXPOP_LOGICAL_OR); 88220604Sjkim<<EOF>> return (EXPOP_EOF); /* null end-of-string */ 89220604Sjkim 90220604Sjkim{LabelRef} return (EXPOP_LABEL); 91220604Sjkim{Number} return (EXPOP_NUMBER); 92220604Sjkim{HexNumber} return (EXPOP_HEX_NUMBER); 93220604Sjkim{NewLine} return (EXPOP_NEW_LINE); 94220604Sjkim{WhiteSpace} /* Ignore */ 95220604Sjkim 96220604Sjkim. return (EXPOP_EOF); 97220604Sjkim 98220604Sjkim%% 99220604Sjkim 100220604Sjkim/* 101220604Sjkim * Local support functions 102220604Sjkim */ 103220604SjkimYY_BUFFER_STATE LexBuffer; 104220604Sjkim 105220604Sjkim/****************************************************************************** 106220604Sjkim * 107220604Sjkim * FUNCTION: DtInitLexer, DtTerminateLexer 108220604Sjkim * 109220604Sjkim * PARAMETERS: String - Input string to be parsed 110220604Sjkim * 111220604Sjkim * RETURN: None 112220604Sjkim * 113220604Sjkim * DESCRIPTION: Initialization and termination routines for lexer. Lexer needs 114220604Sjkim * a buffer to handle strings instead of a file. 115220604Sjkim * 116220604Sjkim *****************************************************************************/ 117220604Sjkim 118220604Sjkimint 119220604SjkimDtInitLexer ( 120220604Sjkim char *String) 121220604Sjkim{ 122220604Sjkim 123220604Sjkim LexBuffer = yy_scan_string (String); 124220604Sjkim return (LexBuffer == NULL); 125220604Sjkim} 126220604Sjkim 127220604Sjkimvoid 128220604SjkimDtTerminateLexer ( 129220604Sjkim void) 130220604Sjkim{ 131220604Sjkim 132220604Sjkim yy_delete_buffer (LexBuffer); 133220658Sjkim} 134