/* ----------------------------------------------------------------------------- Copyright 2023 Kevin P. Barry Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------------------------------- */ // Author: Kevin P. Barry [ta0kira@gmail.com] $ModuleOnly$ // Hierarchical parsed data from Zeolite source files. concrete ZeoliteParsed { refines Formatted refines FormattedToken refines TestCompare visibility Tokenizer @type leaf (String label:, String content:) -> (ZeoliteParsed) @type section (String label:, DefaultOrder) -> (ZeoliteParsed) } // Singleton tokenizer with a name. @type interface NamedTokenizer { tokenizer () -> (Tokenizer) tokenizerName () -> (String) } // Context used when parsing Zeolite source files. concrete ZeoliteParseContext { refines KVReader> @type new () -> (ZeoliteParseContext) @value defaultTokenizer () -> (Tokenizer) @value include<#t> #t defines NamedTokenizer () -> (ZeoliteParseContext) } // Delegate to a tokenizer by name. concrete UseNamedTokenizer { @type new<#t> #t defines NamedTokenizer () -> (Tokenizer) } // Attempts multiple tokenizers in order. concrete TokenAlternatives { refines Append> refines Tokenizer @type new () -> (TokenAlternatives) } // Zeolite symbol parsing. concrete ZeoliteSymbol { // Parses symbol and returns the stream forwarded to the end of the symbol. @type parseUpperSymbol (TextStream) -> (optional TextStream) @type parseLowerSymbol (TextStream) -> (optional TextStream) @type parseParamName (TextStream) -> (optional TextStream) @type parseScopeQualifier (TextStream) -> (optional TextStream) @type parseOperatorSymbols (TextStream) -> (optional TextStream) // Caller must check for \ first. Stream isn't reset! @type parseEscapedChar (TextStream) -> (optional TextStream) // Returns a type label if the token is in the given set. @type tryControlKeyword (String) -> (optional String) @type tryTypeKeyword (String) -> (optional String) @type tryContainKeyword (String) -> (optional String) @type tryStorageKeyword (String) -> (optional String) @type tryScopeQualifier (String) -> (optional String) @type tryTestcaseKeyword (String) -> (optional String) @type tryBuiltinCategory (String) -> (optional String) @type tryBuiltinFunction (String) -> (optional String) @type tryBuiltinConstant (String) -> (optional String) @type tryBuiltinParam (String) -> (optional String) @type tryAssignment (String) -> (optional String) @type tryFunctionCall (String) -> (optional String) }