Lines Matching refs:delboy
55 static ANTLR3_BOOLEAN handshake (pANTLR3_DEBUG_EVENT_LISTENER delboy);
56 static void enterRule (pANTLR3_DEBUG_EVENT_LISTENER delboy, const char * grammarFileName, const char * ruleName);
57 static void enterAlt (pANTLR3_DEBUG_EVENT_LISTENER delboy, int alt);
58 static void exitRule (pANTLR3_DEBUG_EVENT_LISTENER delboy, const char * grammarFileName, const char * ruleName);
59 static void enterSubRule (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber);
60 static void exitSubRule (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber);
61 static void enterDecision (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber);
62 static void exitDecision (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber);
63 static void consumeToken (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_COMMON_TOKEN t);
64 static void consumeHiddenToken (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_COMMON_TOKEN t);
65 static void LT (pANTLR3_DEBUG_EVENT_LISTENER delboy, int i, pANTLR3_COMMON_TOKEN t);
66 static void mark (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_MARKER marker);
67 static void rewindMark (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_MARKER marker);
68 static void rewindLast (pANTLR3_DEBUG_EVENT_LISTENER delboy);
69 static void beginBacktrack (pANTLR3_DEBUG_EVENT_LISTENER delboy, int level);
70 static void endBacktrack (pANTLR3_DEBUG_EVENT_LISTENER delboy, int level, ANTLR3_BOOLEAN successful);
71 static void location (pANTLR3_DEBUG_EVENT_LISTENER delboy, int line, int pos);
72 static void recognitionException (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_EXCEPTION e);
73 static void beginResync (pANTLR3_DEBUG_EVENT_LISTENER delboy);
74 static void endResync (pANTLR3_DEBUG_EVENT_LISTENER delboy);
75 static void semanticPredicate (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_BOOLEAN result, const char * predicate);
76 static void commence (pANTLR3_DEBUG_EVENT_LISTENER delboy);
77 static void terminate (pANTLR3_DEBUG_EVENT_LISTENER delboy);
78 static void consumeNode (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t);
79 static void LTT (pANTLR3_DEBUG_EVENT_LISTENER delboy, int i, pANTLR3_BASE_TREE t);
80 static void nilNode (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t);
81 static void errorNode (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t);
82 static void createNode (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t);
83 static void createNodeTok (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE node, pANTLR3_COMMON_TOKEN token);
84 static void becomeRoot (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE newRoot, pANTLR3_BASE_TREE oldRoot);
85 static void addChild (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE root, pANTLR3_BASE_TREE child);
86 static void setTokenBoundaries (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t, ANTLR3_MARKER tokenStartIndex, ANTLR3_MARKER tokenStopIndex);
87 static void ack (pANTLR3_DEBUG_EVENT_LISTENER delboy);
95 pANTLR3_DEBUG_EVENT_LISTENER delboy;
97 delboy = ANTLR3_CALLOC(1, sizeof(ANTLR3_DEBUG_EVENT_LISTENER));
99 if (delboy == NULL)
106 delboy->addChild = addChild;
107 delboy->becomeRoot = becomeRoot;
108 delboy->beginBacktrack = beginBacktrack;
109 delboy->beginResync = beginResync;
110 delboy->commence = commence;
111 delboy->consumeHiddenToken = consumeHiddenToken;
112 delboy->consumeNode = consumeNode;
113 delboy->consumeToken = consumeToken;
114 delboy->createNode = createNode;
115 delboy->createNodeTok = createNodeTok;
116 delboy->endBacktrack = endBacktrack;
117 delboy->endResync = endResync;
118 delboy->enterAlt = enterAlt;
119 delboy->enterDecision = enterDecision;
120 delboy->enterRule = enterRule;
121 delboy->enterSubRule = enterSubRule;
122 delboy->exitDecision = exitDecision;
123 delboy->exitRule = exitRule;
124 delboy->exitSubRule = exitSubRule;
125 delboy->handshake = handshake;
126 delboy->location = location;
127 delboy->LT = LT;
128 delboy->LTT = LTT;
129 delboy->mark = mark;
130 delboy->nilNode = nilNode;
131 delboy->recognitionException = recognitionException;
132 delboy->rewind = rewindMark;
133 delboy->rewindLast = rewindLast;
134 delboy->semanticPredicate = semanticPredicate;
135 delboy->setTokenBoundaries = setTokenBoundaries;
136 delboy->terminate = terminate;
137 delboy->errorNode = errorNode;
139 delboy->PROTOCOL_VERSION = 2; // ANTLR 3.1 is at protocol version 2
141 delboy->port = DEFAULT_DEBUGGER_PORT;
143 return delboy;
149 pANTLR3_DEBUG_EVENT_LISTENER delboy;
151 delboy = antlr3DebugListenerNew();
153 if (delboy != NULL)
155 delboy->port = port;
158 return delboy;
194 handshake (pANTLR3_DEBUG_EVENT_LISTENER delboy)
220 if (delboy->initialized == ANTLR3_FALSE)
260 server.sin_port = htons((unsigned short)delboy->port);
287 delboy->socket = accept(serverSocket, (pANTLR3_SOCKADDRC)&client, &sockaddr_len);
294 if (delboy->socket == -1)
302 setsockopt(delboy->socket, SOL_SOCKET, TCP_NODELAY, (const void *)&optVal, sizeof(optVal));
310 sprintf (message, "ANTLR %d\n", delboy->PROTOCOL_VERSION);
311 sockSend (delboy->socket, message, (int)strlen(message));
312 sprintf (message, "grammar \"%s\n", delboy->grammarFileName->chars);
313 sockSend (delboy->socket, message, (int)strlen(message));
314 ack (delboy);
316 delboy->initialized = ANTLR3_TRUE;
323 transmit(pANTLR3_DEBUG_EVENT_LISTENER delboy, const char * ptr)
325 sockSend(delboy->socket, ptr, (int)strlen(ptr));
326 ack(delboy);
330 ack (pANTLR3_DEBUG_EVENT_LISTENER delboy)
343 rCount = recv(delboy->socket, &buffer, 1, 0);
418 serializeToken(pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_COMMON_TOKEN t)
422 if (delboy->tokenString == NULL)
428 delboy->tokenString = delboy->grammarFileName->factory->newSize(delboy->grammarFileName->factory, 64);
433 delboy->tokenString->set(delboy->tokenString, (const char *)"");
438 delboy->tokenString->addi(delboy->tokenString, (ANTLR3_INT32)(t->getTokenIndex(t)));
439 delboy->tokenString->addc(delboy->tokenString, '\t');
440 delboy->tokenString->addi(delboy->tokenString, (ANTLR3_INT32)(t->getType(t)));
441 delboy->tokenString->addc(delboy->tokenString, '\t');
442 delboy->tokenString->addi(delboy->tokenString, (ANTLR3_INT32)(t->getChannel(t)));
443 delboy->tokenString->addc(delboy->tokenString, '\t');
444 delboy->tokenString->addi(delboy->tokenString, (ANTLR3_INT32)(t->getLine(t)));
445 delboy->tokenString->addc(delboy->tokenString, '\t');
446 delboy->tokenString->addi(delboy->tokenString, (ANTLR3_INT32)(t->getCharPositionInLine(t)));
450 serializeText(delboy->tokenString, t->getText(t));
457 return delboy->tokenString->toUTF8(delboy->tokenString);
464 serializeNode(pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE node)
471 if (delboy->tokenString == NULL)
477 delboy->tokenString = delboy->grammarFileName->factory->newSize(delboy->grammarFileName->factory, 64);
482 delboy->tokenString->set(delboy->tokenString, (const char *)"");
488 return delboy->tokenString;
494 delboy->tokenString->addc(delboy->tokenString, '\t');
498 delboy->tokenString->addi(delboy->tokenString, delboy->adaptor->getUniqueID(delboy->adaptor, node));
499 delboy->tokenString->addc(delboy->tokenString, '\t');
503 delboy->tokenString->addi(delboy->tokenString, delboy->adaptor->getType(delboy->adaptor, node));
507 token = delboy->adaptor->getToken(delboy->adaptor, node);
509 delboy->tokenString->addc(delboy->tokenString, '\t');
514 delboy->tokenString->addi(delboy->tokenString, (ANTLR3_INT32)(token->getLine(token)));
515 delboy->tokenString->addc(delboy->tokenString, ' ');
516 delboy->tokenString->addi(delboy->tokenString, (ANTLR3_INT32)(token->getCharPositionInLine(token)));
522 delboy->tokenString->addi(delboy->tokenString, -1);
523 delboy->tokenString->addc(delboy->tokenString, '\t');
524 delboy->tokenString->addi(delboy->tokenString, -1);
529 delboy->tokenString->addc(delboy->tokenString, '\t');
530 delboy->tokenString->addi(delboy->tokenString, (ANTLR3_UINT32)(delboy->adaptor->getTokenStartIndex(delboy->adaptor, node)));
534 serializeText(delboy->tokenString, delboy->adaptor->getText(delboy->adaptor, node));
541 return delboy->tokenString->toUTF8(delboy->tokenString);
548 enterRule (pANTLR3_DEBUG_EVENT_LISTENER delboy, const char * grammarFileName, const char * ruleName)
555 transmit(delboy, buffer);
559 enterAlt (pANTLR3_DEBUG_EVENT_LISTENER delboy, int alt)
566 transmit(delboy, buffer);
570 exitRule (pANTLR3_DEBUG_EVENT_LISTENER delboy, const char * grammarFileName, const char * ruleName)
577 transmit(delboy, buffer);
581 enterSubRule (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber)
588 transmit(delboy, buffer);
592 exitSubRule (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber)
599 transmit(delboy, buffer);
603 enterDecision (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber)
610 transmit(delboy, buffer);
615 exitDecision (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber)
622 transmit(delboy, buffer);
626 consumeToken (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_COMMON_TOKEN t)
632 msg = serializeToken(delboy, t);
642 transmit(delboy, (const char *)(msg->chars));
646 consumeHiddenToken (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_COMMON_TOKEN t)
652 msg = serializeToken(delboy, t);
662 transmit(delboy, (const char *)(msg->chars));
668 LT (pANTLR3_DEBUG_EVENT_LISTENER delboy, int i, pANTLR3_COMMON_TOKEN t)
676 msg = serializeToken(delboy, t);
691 transmit(delboy, (const char *)(msg->chars));
696 mark (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_MARKER marker)
704 transmit(delboy, buffer);
708 rewindMark (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_MARKER marker)
716 transmit(delboy, buffer);
721 rewindLast (pANTLR3_DEBUG_EVENT_LISTENER delboy)
723 transmit(delboy, (const char *)"rewind\n");
727 beginBacktrack (pANTLR3_DEBUG_EVENT_LISTENER delboy, int level)
735 transmit(delboy, buffer);
739 endBacktrack (pANTLR3_DEBUG_EVENT_LISTENER delboy, int level, ANTLR3_BOOLEAN successful)
747 transmit(delboy, buffer);
751 location (pANTLR3_DEBUG_EVENT_LISTENER delboy, int line, int pos)
759 transmit(delboy, buffer);
763 recognitionException (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_EXCEPTION e)
771 transmit(delboy, buffer);
775 beginResync (pANTLR3_DEBUG_EVENT_LISTENER delboy)
777 transmit(delboy, (const char *)"beginResync\n");
781 endResync (pANTLR3_DEBUG_EVENT_LISTENER delboy)
783 transmit(delboy, (const char *)"endResync\n");
787 semanticPredicate (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_BOOLEAN result, const char * predicate)
840 transmit(delboy, (const char *)buffer);
850 commence (pANTLR3_DEBUG_EVENT_LISTENER delboy)
861 terminate (pANTLR3_DEBUG_EVENT_LISTENER delboy)
865 sockSend(delboy->socket, "terminate\n", 10); // Send out the command
872 consumeNode (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t)
876 buffer = serializeNode (delboy, t);
885 transmit (delboy, (const char *)(delboy->tokenString->toUTF8(delboy->tokenString)->chars));
889 LTT (pANTLR3_DEBUG_EVENT_LISTENER delboy, int i, pANTLR3_BASE_TREE t)
893 buffer = serializeNode (delboy, t);
904 transmit (delboy, (const char *)(delboy->tokenString->toUTF8(delboy->tokenString)->chars));
908 nilNode (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t)
911 sprintf(buffer, "nilNode\t%d\n", delboy->adaptor->getUniqueID(delboy->adaptor, t));
912 transmit(delboy, buffer);
916 createNode (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t)
920 if (delboy->tokenString == NULL)
926 delboy->tokenString = delboy->grammarFileName->factory->newSize(delboy->grammarFileName->factory, 64);
931 delboy->tokenString->set8(delboy->tokenString, (const char *)"createNodeFromTokenElements ");
938 delboy->tokenString->addi(delboy->tokenString, delboy->adaptor->getUniqueID(delboy->adaptor, t));
939 delboy->tokenString->addc(delboy->tokenString, '\t');
943 delboy->tokenString->addi(delboy->tokenString, delboy->adaptor->getType(delboy->adaptor, t));
947 serializeText(delboy->tokenString, delboy->adaptor->getText(delboy->adaptor, t));
948 delboy->tokenString->addc(delboy->tokenString, '\n');
955 transmit(delboy, (const char *)(delboy->tokenString->toUTF8(delboy->tokenString)->chars));
959 errorNode (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t)
963 if (delboy->tokenString == NULL)
969 delboy->tokenString = delboy->grammarFileName->factory->newSize(delboy->grammarFileName->factory, 64);
974 delboy->tokenString->set8(delboy->tokenString, (const char *)"errorNode\t");
981 delboy->tokenString->addi(delboy->tokenString, delboy->adaptor->getUniqueID(delboy->adaptor, t));
982 delboy->tokenString->addc(delboy->tokenString, '\t');
986 delboy->tokenString->addi(delboy->tokenString, ANTLR3_TOKEN_INVALID);
990 serializeText(delboy->tokenString, delboy->adaptor->getText(delboy->adaptor, t));
991 delboy->tokenString->addc(delboy->tokenString, '\n');
998 transmit(delboy, (const char *)(delboy->tokenString->toUTF8(delboy->tokenString)->chars));
1003 createNodeTok (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE node, pANTLR3_COMMON_TOKEN token)
1007 sprintf(buffer, "createNode\t%d\t%d\n", delboy->adaptor->getUniqueID(delboy->adaptor, node), (ANTLR3_UINT32)token->getTokenIndex(token));
1009 transmit(delboy, buffer);
1013 becomeRoot (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE newRoot, pANTLR3_BASE_TREE oldRoot)
1017 sprintf(buffer, "becomeRoot\t%d\t%d\n", delboy->adaptor->getUniqueID(delboy->adaptor, newRoot),
1018 delboy->adaptor->getUniqueID(delboy->adaptor, oldRoot)
1020 transmit(delboy, buffer);
1025 addChild (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE root, pANTLR3_BASE_TREE child)
1029 sprintf(buffer, "addChild\t%d\t%d\n", delboy->adaptor->getUniqueID(delboy->adaptor, root),
1030 delboy->adaptor->getUniqueID(delboy->adaptor, child)
1032 transmit(delboy, buffer);
1036 setTokenBoundaries (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t, ANTLR3_MARKER tokenStartIndex, ANTLR3_MARKER tokenStopIndex)
1040 sprintf(buffer, "becomeRoot\t%d\t%d\t%d\n", delboy->adaptor->getUniqueID(delboy->adaptor, t),
1044 transmit(delboy, buffer);