25 #include "common/array.h" 26 #include "common/str.h" 27 #include "common/stream.h" 28 #include "common/debug.h" 33 enum class YackTokenId {
59 ERR_BRACKETRIEXPECTED,
96 YOnce(
int line) { _line = line; }
131 YGoto(
int line) { _line = line; }
264 virtual ~
YLabel()
override;
287 virtual void visit(
const YStatement &node) { defaultVisit(node); }
288 virtual void visit(
const YWaitFor &node) { defaultVisit(node); }
289 virtual void visit(
const YWaitWhile &node) { defaultVisit(node); }
290 virtual void visit(
const YLimit &node) { defaultVisit(node); }
291 virtual void visit(
const YAllowObjects &node) { defaultVisit(node); }
292 virtual void visit(
const YShutup &node) { defaultVisit(node); }
293 virtual void visit(
const YOverride &node) { defaultVisit(node); }
294 virtual void visit(
const YDialog &node) { defaultVisit(node); }
295 virtual void visit(
const YParrot &node) { defaultVisit(node); }
296 virtual void visit(
const YPause &node) { defaultVisit(node); }
297 virtual void visit(
const YSay &node) { defaultVisit(node); }
298 virtual void visit(
const YChoice &node) { defaultVisit(node); }
299 virtual void visit(
const YCodeExp &node) { defaultVisit(node); }
300 virtual void visit(
const YGoto &node) { defaultVisit(node); }
301 virtual void visit(
const YTempOnce &node) { defaultVisit(node); }
302 virtual void visit(
const YOnceEver &node) { defaultVisit(node); }
303 virtual void visit(
const YShowOnce &node) { defaultVisit(node); }
304 virtual void visit(
const YOnce &node) { defaultVisit(node); }
305 virtual void visit(
const YCodeCond &node) { defaultVisit(node); }
306 virtual void visit(
const YLabel &node) { defaultVisit(node); }
308 virtual void defaultVisit(
const YackNode &node) {}
312 YackTokenId
id = YackTokenId::None;
325 using difference_type = ptrdiff_t;
344 _reader = rhs._reader;
347 bool operator==(
const Iterator &rhs)
const {
return _pos == rhs._pos; }
348 bool operator!=(
const Iterator &rhs)
const {
return _pos != rhs._pos; }
364 bool readYackToken(YackToken &YackToken);
366 YackTokenId readYackTokenId();
367 YackTokenId readCode();
368 YackTokenId readCondition();
369 YackTokenId readDollar();
370 YackTokenId readNumber();
371 YackTokenId readComment();
372 YackTokenId readString();
373 YackTokenId readIdentifier(
char c);
375 void ignore(int64 n = 1,
int delim = EOF);
390 bool match(
const std::initializer_list<YackTokenId> &ids);
412 debug(
"CompilationUnit:");
413 for (
const auto &cond : node._labels) {
417 virtual void visit(
const YLabel &node) {
418 debug(
"Label: %s [%d]", node._name.c_str(), node._line);
419 for (
const auto &stmt : node._stmts) {
425 for (
const auto &cond : node._conds) {
428 node._exp->accept(*
this);
430 virtual void visit(
const YWaitFor &node) {
debug(
"WaifFor %s", node._actor.c_str()); }
431 virtual void visit(
const YWaitWhile &node) {
debug(
"WaitWhile %s", node._cond.c_str()); }
432 virtual void visit(
const YLimit &node) {
debug(
"Limit: %d", node._max); }
434 virtual void visit(
const YShutup &node) {
debug(
"Shutup"); }
435 virtual void visit(
const YOverride &node) { defaultVisit(node); }
436 virtual void visit(
const YDialog &node) {
debug(
"Dialog: %s", node._actor.c_str()); }
437 virtual void visit(
const YParrot &node) {
debug(
"Parrot: %s", node._active ?
"YES" :
"NO"); }
438 virtual void visit(
const YPause &node) {
debug(
"Pause: %d", node._time); }
439 virtual void visit(
const YSay &node) {
debug(
"Say: actor: %s, text = %s", node._actor.c_str(), node._text.c_str()); }
440 virtual void visit(
const YChoice &node) {
debug(
"Choice %d: %s -> %s", node._number, node._text.c_str(), node._goto->_name.c_str()); }
441 virtual void visit(
const YCodeExp &node) {
debug(
"Code: %s", node._code.c_str()); }
442 virtual void visit(
const YGoto &node) {
debug(
"Goto: %s", node._name.c_str()); }
446 virtual void visit(
const YOnce &node) {
debug(
"Once"); }
447 virtual void visit(
const YCodeCond &node) {
debug(
"Cond: %s", node._code.c_str()); }
449 virtual void defaultVisit(
const YackNode &node) {}
void debug(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: achievements_tables.h:27