aboutsummaryrefslogtreecommitdiff
path: root/src/parser.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
commit393f1b414746a7f1977971dd7659dd2b47092b11 (patch)
tree81d0ca1ee70ab86a7d79c1991abe5c387b655fb2 /src/parser.h
parentc259f95bd0e58b247940a339bb9b4b401b4e9438 (diff)
parent7e25a863325dc3e9762397e700030969e093b087 (diff)
downloadlibbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.gz
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.bz2
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.xz
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.zip
Wow! Merged the branch, streams are updated, and there's no more FString, run
the fixstrings.sh script in the support directory to (hopefully) automatically update your projects.
Diffstat (limited to 'src/parser.h')
-rw-r--r--src/parser.h33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/parser.h b/src/parser.h
index a925188..a168c7b 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -1,7 +1,14 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#ifndef BU_PARSER_H 8#ifndef BU_PARSER_H
2#define BU_PARSER_H 9#define BU_PARSER_H
3 10
4#include "bu/fstring.h" 11#include "bu/string.h"
5#include "bu/list.h" 12#include "bu/list.h"
6#include "bu/array.h" 13#include "bu/array.h"
7#include "bu/hash.h" 14#include "bu/hash.h"
@@ -43,7 +50,7 @@ namespace Bu
43 void parse(); 50 void parse();
44 51
45 void setRootNonTerminal( int iRoot ); 52 void setRootNonTerminal( int iRoot );
46 void setRootNonTerminal( const Bu::FString &sRoot ); 53 void setRootNonTerminal( const Bu::String &sRoot );
47 54
48 typedef Bu::Signal1<void, Parser &> Reduction; 55 typedef Bu::Signal1<void, Parser &> Reduction;
49 56
@@ -87,17 +94,17 @@ namespace Bu
87 bool bCanSkip; 94 bool bCanSkip;
88 }; 95 };
89 96
90 int addNonTerminal( const Bu::FString &sName, NonTerminal &nt ); 97 int addNonTerminal( const Bu::String &sName, NonTerminal &nt );
91 int addNonTerminal( const Bu::FString &sName ); 98 int addNonTerminal( const Bu::String &sName );
92 void setNonTerminal( const Bu::FString &sName, NonTerminal &nt ); 99 void setNonTerminal( const Bu::String &sName, NonTerminal &nt );
93 int getNonTerminalId( const Bu::FString &sName ); 100 int getNonTerminalId( const Bu::String &sName );
94 bool hasNonTerminal( const Bu::FString &sName ); 101 bool hasNonTerminal( const Bu::String &sName );
95 102
96 int addReduction( const Bu::FString &sName, const Reduction &r ); 103 int addReduction( const Bu::String &sName, const Reduction &r );
97 int addReduction( const Bu::FString &sName ); 104 int addReduction( const Bu::String &sName );
98 void setReduction( const Bu::FString &sName, const Reduction &r ); 105 void setReduction( const Bu::String &sName, const Reduction &r );
99 int getReductionId( const Bu::FString &sName ); 106 int getReductionId( const Bu::String &sName );
100 bool hasReduction( const Bu::FString &sName ); 107 bool hasReduction( const Bu::String &sName );
101 108
102 private: 109 private:
103 bool selectProduction( int iNt, Lexer::Token *ptCur ); 110 bool selectProduction( int iNt, Lexer::Token *ptCur );
@@ -108,7 +115,7 @@ namespace Bu
108 typedef Bu::List<Lexer::Token *> TokenStack; 115 typedef Bu::List<Lexer::Token *> TokenStack;
109 typedef Bu::List<Production::const_iterator> StateStack; 116 typedef Bu::List<Production::const_iterator> StateStack;
110 typedef Bu::Array<Reduction> ReductionArray; 117 typedef Bu::Array<Reduction> ReductionArray;
111 typedef Bu::Hash<Bu::FString,int> NameIndexHash; 118 typedef Bu::Hash<Bu::String,int> NameIndexHash;
112 typedef Bu::Array<NonTerminal> NonTerminalArray; 119 typedef Bu::Array<NonTerminal> NonTerminalArray;
113 120
114 LexerStack sLexer; 121 LexerStack sLexer;