Пример #1
0
  void MetaParser::consumeAnyStringToken(tok::TokenKind stopAt/*=tok::space*/) {
    consumeToken();
    // we have to merge the tokens from the queue until we reach eof token or
    // space token
    skipWhitespace();
    // Add the new token in which we will merge the others.
    Token& MergedTok = m_TokenCache.front();

    if (MergedTok.is(stopAt) || MergedTok.is(tok::eof)
        || MergedTok.is(tok::comment))
      return;

    //look ahead for the next token without consuming it
    Token Tok = lookAhead(1);
    Token PrevTok = Tok;
    while (Tok.isNot(stopAt) && Tok.isNot(tok::eof)){
      //MergedTok.setLength(MergedTok.getLength() + Tok.getLength());
      m_TokenCache.erase(m_TokenCache.begin() + 1);
      PrevTok = Tok;
      //look ahead for the next token without consuming it
      Tok = lookAhead(1);
    }
    MergedTok.setKind(tok::raw_ident);
    if (PrevTok.is(tok::space)) {
      // for "id <space> eof" the merged token should contain "id", not
      // "id <space>".
      Tok = PrevTok;
    }
    MergedTok.setLength(Tok.getBufStart() - MergedTok.getBufStart());
  }
Пример #2
0
void XtgScanner::setTabStops()
{
	QList<ParagraphStyle::TabRecord> tbs = currentParagraphStyle.tabValues();
	tbs.clear();
	if (lookAhead() == '0')
	{
		currentParagraphStyle.setTabValues(tbs);
		return;
	}
	while (lookAhead() != ')')
	{
		token = getToken();
		double pos = token.toDouble();
		token = getToken();
		int typ = token.toInt();
		token = getToken();
		ParagraphStyle::TabRecord tb;
		if (typ == 0)
			tb.tabType = 0;
		else if (typ == 2)
			tb.tabType = 1;
		else if (typ == 1)
			tb.tabType = 4;
		else if (typ == 4)
			tb.tabType = 3;
		tb.tabType = typ;
		tb.tabPosition = pos;
		tb.tabFillChar = QChar();
		tbs.append(tb);
	}
	currentParagraphStyle.setTabValues(tbs);
	
}
Пример #3
0
void XtgScanner::defColon()
{
	flushText();
	if ((sfcName == "@") || (sfcName == "@$:") || (sfcName == "@:"))
	{
		QString pStyle = CommonStrings::DefaultParagraphStyle;
		ParagraphStyle newStyle;
		newStyle.setParent(pStyle);
		newStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
		currentParagraphStyle = newStyle;
		currentCharStyle = newStyle.charStyle();
		currentCharStyle.setFontSize(120.0);
		styleEffects = ScStyle_None;
		currentCharStyle.setFeatures(styleEffects.featureList());
	}
	else if (doc->paragraphStyles().contains(m_item->itemName() + "_" + sfcName))
	{
		ParagraphStyle newStyle;
		newStyle.setParent(m_item->itemName() + "_" + sfcName);
		currentParagraphStyle = newStyle;
		currentCharStyle = newStyle.charStyle();
	}
	else if (doc->paragraphStyles().contains(sfcName))
	{
		ParagraphStyle newStyle;
		newStyle.setParent(sfcName);
		currentParagraphStyle = newStyle;
		currentCharStyle = newStyle.charStyle();
	}
	else
	{
		QString pStyle = CommonStrings::DefaultParagraphStyle;
		ParagraphStyle newStyle;
		newStyle.setParent(pStyle);
		newStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
		currentParagraphStyle = newStyle;
		currentCharStyle = newStyle.charStyle();
		currentCharStyle.setFontSize(120.0);
		styleEffects = ScStyle_None;
		currentCharStyle.setFeatures(styleEffects.featureList());
	}
	if (newlineFlag)
	{
		int posT = m_item->itemText.length();
		if (posT > 0)
		{
			m_item->itemText.insertChars(posT, SpecialChars::PARSEP);
			m_item->itemText.applyStyle(posT, currentParagraphStyle);
		}
	}
	newlineFlag = false;
	enterState(textMode);
	define = 0;
	if (!((lookAhead() == '\r') || (lookAhead() == '\n')))
		inDef = false;
}
Пример #4
0
void XtgScanner::defAtRate()
{
	enterState(nameMode);
	sfcName = getToken();
	if (sfcName == "@$:")
	{
		if (doc->paragraphStyles().contains(m_item->itemName() + "_Normal"))
		{
			ParagraphStyle newStyle;
			newStyle.setParent(m_item->itemName() + "_Normal");
			currentParagraphStyle = newStyle;
			currentCharStyle = newStyle.charStyle();
		}
		else if (doc->paragraphStyles().contains("Normal"))
		{
			ParagraphStyle newStyle;
			newStyle.setParent("Normal");
			currentParagraphStyle = newStyle;
			currentCharStyle = newStyle.charStyle();
		}
		enterState(previousState());
	}
	else if (sfcName == "@:")
	{
		QString pStyle = CommonStrings::DefaultParagraphStyle;
		ParagraphStyle newStyle;
		newStyle.setParent(pStyle);
		newStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
		currentParagraphStyle = newStyle;
		currentCharStyle = newStyle.charStyle();
		currentCharStyle.setFontSize(120.0);
		styleEffects = ScStyle_None;
		currentCharStyle.setFeatures(styleEffects.featureList());
		enterState(textMode);
	}
	else if (doc->paragraphStyles().contains(m_item->itemName() + "_" + sfcName))
	{
		ParagraphStyle newStyle;
		newStyle.setParent(m_item->itemName() + "_" + sfcName);
		currentParagraphStyle = newStyle;
		currentCharStyle = newStyle.charStyle();
		if (lookAhead() == ':')
			top++;
		enterState(textMode);
	}
	else if (doc->paragraphStyles().contains(sfcName))
	{
		ParagraphStyle newStyle;
		newStyle.setParent(sfcName);
		currentParagraphStyle = newStyle;
		currentCharStyle = newStyle.charStyle();
		if (lookAhead() == ':')
			top++;
		enterState(textMode);
	}
}
Пример #5
0
void XtgScanner::setKeepTogether()
{
	if (lookAhead() == '(')
	{
		while (lookAhead() != ')')
			token.append( nextSymbol() );
	}
	else
		token.append(nextSymbol());
	unSupported.append(token);
}
Пример #6
0
void XtgScanner::setPRuleBelow()
{
	unSupported.insert(token);
	if (lookAhead() == '0')
	{
		top++;
		return;
	}
	while (lookAhead() != ')')
		top++;
}
Пример #7
0
/**
 * Parse assignments in the form <identifier> '=' <value>
 * Instance variables are identified by a prefixed 'self.'.
 * @return success status of parsing
 */
bool PythonImport::parseAssignmentStmt(const QString keyword)
{
    QString variable = keyword;
    advance();
    QString value = advance();
    if (value == QLatin1String("-"))
        value.append(advance());

    bool isStatic = true;
    if (variable.startsWith(QLatin1String("self."))) {
        variable.remove(0,5);
        isStatic = false;
    }
    Uml::Visibility::Enum visibility = Uml::Visibility::Public;
    if (variable.startsWith(QLatin1String("__"))) {
        visibility = Uml::Visibility::Private;
        variable.remove(0, 2);
    } else if (variable.startsWith(QLatin1String("_"))) {
        visibility = Uml::Visibility::Protected;
        variable.remove(0, 1);
    }
    QString type;
    if (value == QLatin1String("[")) {
        if (lookAhead() == QLatin1String("]")) {
            advance();
            type = QLatin1String("list");
            value = QLatin1String("");
        }
    } else if (value == QLatin1String("{")) {
        if (lookAhead() == QLatin1String("}")) {
            advance();
            type = QLatin1String("dict");
            value = QLatin1String("");
        }
    } else if (value.startsWith(QLatin1String("\""))) {
        type = QLatin1String("string");
    } else if (value == QLatin1String("True") || value == QLatin1String("False")) {
        type = QLatin1String("bool");
    } else if (value.contains(QRegExp(QLatin1String("-?\\d+\\.\\d*")))) {
        type = QLatin1String("float");
    } else if (value.contains(QRegExp(QLatin1String("-?\\d+")))) {
        type = QLatin1String("int");
    } else if (!value.isEmpty()) {
        type = QLatin1String("object");
    }

    UMLObject* o = Import_Utils::insertAttribute(m_klass, visibility, variable,
                                                 type, m_comment, false);
    UMLAttribute* a = o->asUMLAttribute();
    a->setInitialValue(value);
    a->setStatic(isStatic);
    return true;
}
Пример #8
0
void XtgScanner::defFontSet()
{
	unSupported.append("[F]");
	while (lookAhead() != '>' )
		top = top+1;
	top = top-1;
}
Пример #9
0
static int tryExpandingMacros(struct hash_table *macros, struct list *input){
	struct pptoken *la1;
	struct pptoken *token;
	struct macro *macro;
	int found;

	la1 = lookAhead(input, 0);

	if(la1->name == PPTN_IDENTIFIER){
		hashTableGetValue(macros, la1->lexeme, (void**)&macro, &found);
		if(found){
			if(!la1->replacements || !stringSetIsMember(la1->replacements, macro->macroName)){
				if(!macro->isFunctionMacro){
					struct list *l;
					listDequeue(input, (void**)&token);
					l = objectMacroReplacement(macro, token);
					listUnshiftList(input, l);
					return 1;
				} else {
					fprintf(stderr, "function macro not implemented\n");
					exit(1);
				}
			} else {
				return 0;
			}
		} else {
			return 0;
		}
	} else {
		return 0;
	}
}
Пример #10
0
void XtgScanner::setPAttributes()
{
	double leftIndent = getToken().toDouble();
	double firstlineIndent = getToken().toDouble();
	double rightIndent = getToken().toDouble();
	double leading = getToken().toDouble();
	double gapBefore = getToken().toDouble();
	double gapAfter = getToken().toDouble();
	top++;
	token="";
	token.append( nextSymbol() );
	if ((token == "g") || (token == "G"))
	{
		// We have to discard (P,S)) since it is not yet supported in Scribus

		while (lookAhead() != ')' )
			top++;
	}
	currentParagraphStyle.setLeftMargin(leftIndent);
	currentParagraphStyle.setRightMargin(rightIndent);
	currentParagraphStyle.setFirstIndent(firstlineIndent);
	currentParagraphStyle.setLineSpacing(leading);
	currentParagraphStyle.setGapBefore(gapBefore);
	currentParagraphStyle.setGapAfter(gapAfter);
	if (token == "G")
		currentParagraphStyle.setUseBaselineGrid(true);
	if (token == "g")
		currentParagraphStyle.setUseBaselineGrid(false);
}
Пример #11
0
void XtgScanner::defNewLine()
{
	flushText();
	if (lookAhead() == '@')
		newlineFlag = true;
	else
		writer->appendText(SpecialChars::PARSEP);
}
Пример #12
0
void XtgScanner::setXPresOwn()
{

	unSupported.append(token+')');
	//All these tags are unsupported in Scribus, so just ignoring them till we find close paranthesis
	while (lookAhead() != ')')
		top=top+1;
	top=top+1;//Ignore )
}
Пример #13
0
void XtgScanner::defHardReturn()
{
	/* I saw a strange nature in XPress Tags that every hardreturn is followed by a soft return, hence fixing the
		new line flag to true */
	if (lookAhead() == '\n')
		newlineFlag = true;
	else
		writer->appendText(SpecialChars::PARSEP);
}
Пример #14
0
QString XtgScanner::sliceString()
{
	QString name;
	if (Mode == stringMode)
	{
		while (lookAhead() != '\"')
		{
			name.append( nextSymbol() );
		}
		top = top+1;
	}
	if (Mode == nameMode)
	{
		while (lookAhead() != '=' || lookAhead() != ':')
		{
			name.append( nextSymbol() );
		}
	}
	return name;
}
Пример #15
0
void XtgScanner::defEquals()	//Token =
{
	//define a character stylesheet with the name in sfcName if the next character is not [
	newlineFlag = false;
	if (lookAhead() != '[')
	{
		define = 1;
		defCharStyle.setParent("");
		enterState(textMode);
	}
	else 
		define = 2;
}
Пример #16
0
void XtgScanner::setPAttributes()
{
	double leftIndent,firstlineIndent,rightIndent,leading,gapBefore,gapAfter;
	leftIndent = getToken().toDouble();
	firstlineIndent = getToken().toDouble();
	rightIndent = getToken().toDouble();
	leading = getToken().toDouble();
	gapBefore = getToken().toDouble();
	gapAfter = getToken().toDouble();
	top = top+1;
	token="";
	token.append( nextSymbol() );

	if (token == "g")
	{
		/* We have to discard (P,S)) since it is not yet supported in Scribus
		*/
		while (lookAhead() != ')' )
			top=top+1;
	}
	if (define == 0)
	{
		flushText();
		currentParagraphStyle.setLeftMargin(leftIndent);
		currentParagraphStyle.setRightMargin(rightIndent);
		currentParagraphStyle.setFirstIndent(firstlineIndent);
		currentParagraphStyle.setLineSpacing(leading);
		currentParagraphStyle.setGapBefore(gapBefore);
		currentParagraphStyle.setGapAfter(gapAfter);
		if (token == "G")
			currentParagraphStyle.setUseBaselineGrid(true);
		if (token == "g")
			currentParagraphStyle.setUseBaselineGrid(false);
		writer->setStyle(currentParagraphStyle);
		currentParagraphStyle = writer->getCurrentStyle();
		currentCharStyle = currentParagraphStyle.charStyle();
	}
	if (define == 2)
	{
		defParagraphStyle.setLeftMargin(leftIndent);
		defParagraphStyle.setRightMargin(rightIndent);
		defParagraphStyle.setFirstIndent(firstlineIndent);
		defParagraphStyle.setLineSpacing(leading);
		defParagraphStyle.setGapBefore(gapBefore);
		defParagraphStyle.setGapAfter(gapAfter);
		if (token == "G")
			defParagraphStyle.setUseBaselineGrid(true);
		if (token == "g")
			defParagraphStyle.setUseBaselineGrid(false);
	}	
}
Пример #17
0
static int isTrigraph(struct list *input){
	int i;
	int la1;
	int la2;
	int la3;

	la1 = lookAhead(input, 0);
	la2 = lookAhead(input, 1);
	la3 = lookAhead(input, 2);

	if(la1 == '\?' || la2 == '\?'){
		i = 0;
		while(trigraphs[i][0] != '\0'){
			if(trigraphs[i][0] == la3){
				return trigraphs[i][1];
			}
			i += 1;
		}
		return 0;
	} else {
		return 0;
	}
}
Пример #18
0
void XtgScanner::defColor()
{
	bool isSpot = false;
	ScColor tmp;
	enterState(stringMode);
	token = getToken();
	while (lookAhead() != '>' )
	{
		token = getToken();
		if ((token == "CMJN") || (token == "CMYK"))
		{
			enterState(tagMode);
			token = getToken();
			if (token == "S")
			{
				token = getToken();
				isSpot = true;
			}
			double c = getToken().toDouble();
			double m = getToken().toDouble();
			double y = getToken().toDouble();
			double k = getToken().toDouble();
			tmp.setColor(qRound(c * 2.55), qRound(m * 255), qRound(y * 255), qRound(k * 255));
			tmp.setSpotColor(isSpot);
			tmp.setRegistrationColor(false);
			doc->PageColors.tryAddColor(sfcName, tmp);
		}
		else if (token == "RGB")
		{
			enterState(tagMode);
			token = getToken();
			if (token == "S")
			{
				token = getToken();
				isSpot = true;
			}
			double r = getToken().toDouble();
			double g = getToken().toDouble();
			double b = getToken().toDouble();
			tmp.setColorRGB(qRound(r * 2.55), qRound(g * 255), qRound(b * 255));
			tmp.setSpotColor(isSpot);
			tmp.setRegistrationColor(false);
			doc->PageColors.tryAddColor(sfcName, tmp);
		}
	}
	top++;
	enterState(textMode);
}
Пример #19
0
void XtgScanner::defEquals()	//Token =
{
	//define a character stylesheet with the name in sfcName if the next character is not [
	newlineFlag = false;
	if (lookAhead() != '[')
	{
		define = 1;
		if (m_prefixName)
			currentCharStyle.setName(m_item->itemName() + "_" + sfcName);
		else
			currentCharStyle.setName(sfcName);
		enterState(textMode);
	}
	else 
		define = 2;
	inDef = true;
}
Пример #20
0
void XtgScanner::defHardReturn()
{
	/* I saw a strange nature in XPress Tags that every hardreturn is followed by a soft return, hence fixing the
		new line flag to true */
	flushText();
	if (lookAhead() == '\n')
		newlineFlag = true;
	else
	{
		int posT = m_item->itemText.length();
		if (posT > 0)
		{
			m_item->itemText.insertChars(posT, SpecialChars::PARSEP);
			m_item->itemText.applyStyle(posT, currentParagraphStyle);
		}
		inDef = false;
	}
}
Пример #21
0
//if-section        (# if / # ifdef / #ifndef )
//control-line      ( #include / etc )
//# non-directive   ( # text newline
//text-line         (text newline )
bool Preprocessor::parseGroupPart(Item *group)
{
    //cout << "parse group part" << endl;
    Q_ASSERT(group->toItemComposite());

    //look up first significant token
    Type token = lookAhead();
    if(token == Token_eof)
        return false;

    //look for '#'
    if(token != Token_preproc)
        return parseTextLine(group);

    //look up first significant token after the '#'
    token = lookAheadSkipHash();
    if(token == Token_eof)
        return false;

    // Check if we are at the end of a group. This is not an neccesarely an
    // error, it happens when we reach an #endif for example.
    if (token == Token_directive_elif || token == Token_directive_else ||
        token == Token_directive_endif)
        return false;

    // if-section?
    if(token == Token_directive_if || token == Token_directive_ifdef ||
        token == Token_directive_ifndef)
        return parseIfSection(group);

    // control-line?
    if (token == Token_directive_define)
        return parseDefineDirective(group);
    if (token ==  Token_directive_undef)
        return parseUndefDirective(group);
    if (token ==  Token_directive_include)
        return parseIncludeDirective(group);
    if (token == Token_directive_error)
        return parseErrorDirective(group);
    if (token ==  Token_directive_pragma)
        return parsePragmaDirective(group);

    return parseNonDirective(group);
}
Пример #22
0
int processXMsg( int streamId, char *readmsg,
                 RuleEngineEventParam *param, Node *node,
                 Env *env, ruleExecInfo_t *rei ) {

    char myhdr[HEADER_TYPE_LEN];
    char mymsg[MAX_NAME_LEN];
    char *outStr = NULL;
    int i, n;
    int iLevel, wCnt;
    int  ruleInx = 0;
    Region *r;
    Res *res;
    rError_t errmsg;
    errmsg.len = 0;
    errmsg.errMsg = NULL;
    r = make_region( 0, NULL );
    ParserContext *context = newParserContext( &errmsg, r );
    Pointer *e = newPointer2( readmsg );
    int rulegen = 1;
    int found;
    int grdf[2];
    int cmd = 0;
    int smallW;

    snprintf( myhdr, HEADER_TYPE_LEN - 1,   "idbug:%s", param->actionName );
    memset( mymsg, 0, sizeof( mymsg ) );

    PARSER_BEGIN( DbgCmd )
    TRY( DbgCmd )
    TTEXT2( "n", "next" );
    cmd = REDEBUG_STEP_OVER;
    OR( DbgCmd )
    TTEXT2( "s", "step" );
    cmd = REDEBUG_NEXT;
    OR( DbgCmd )
    TTEXT2( "f", "finish" );
    cmd = REDEBUG_STEP_OUT;
    OR( DbgCmd )
    TTEXT2( "b", "break" );
    TRY( Param )
    TTYPE( TK_TEXT );
    int breakPointsInx2;
    for ( breakPointsInx2 = 0; breakPointsInx2 < 100; breakPointsInx2++ ) {
        if ( breakPoints[breakPointsInx2].actionName == NULL ) {
            break;
        }
    }
    if ( breakPointsInx2 == 100 ) {
        _writeXMsg( streamId, myhdr, "Maximum breakpoint count reached. Breakpoint not set.\n" );
        cmd = REDEBUG_WAIT;
    }
    else {
        breakPoints[breakPointsInx2].actionName = strdup( token->text );
        char * base_ptr = NULL;
        TRY( loc )
        TTYPE( TK_TEXT );
        base_ptr = ( char * ) malloc( sizeof( token->text ) + 2 );
        base_ptr[0] = 'f';
        strcpy( base_ptr + 1, token->text );
        TTEXT( ":" );
        TTYPE( TK_INT );
        breakPoints[breakPointsInx2].base = strdup( base_ptr );
        breakPoints[breakPointsInx2].line = atoi( token->text );
        rodsLong_t range[2];
        char rulesFileName[MAX_NAME_LEN];
        getRuleBasePath( base_ptr, rulesFileName );

        FILE *file;
        /* char errbuf[ERR_MSG_LEN]; */
        file = fopen( rulesFileName, "r" );
        if ( file == NULL ) {
            free( context );
            deletePointer( e );
            free( base_ptr );
            return RULES_FILE_READ_ERROR;
        }
        Pointer *p = newPointer( file, base_ptr );


        if ( getLineRange( p, breakPoints[breakPointsInx2].line, range ) == 0 ) {
            breakPoints[breakPointsInx2].start = range[0];
            breakPoints[breakPointsInx2].finish = range[1];
        }
        else {
            breakPoints[breakPointsInx2].actionName = NULL;
        }
        deletePointer( p );
        OR( loc )
        TTYPE( TK_INT );
        if ( node != NULL ) {
            breakPoints[breakPointsInx2].base = strdup( node->base );
            breakPoints[breakPointsInx2].line = atoi( token->text );
            rodsLong_t range[2];
            Pointer *p = newPointer2( breakPoints[breakPointsInx2].base );
            if ( getLineRange( p, breakPoints[breakPointsInx2].line, range ) == 0 ) {
                breakPoints[breakPointsInx2].start = range[0];
                breakPoints[breakPointsInx2].finish = range[1];
            }
            else {
                breakPoints[breakPointsInx2].actionName = NULL;
            }
            deletePointer( p );
        }
        else {
            breakPoints[breakPointsInx2].actionName = NULL;
        }
        OR( loc )
        /* breakPoints[breakPointsInx].base = NULL; */
        END_TRY( loc )

        free( base_ptr );
        if ( breakPoints[breakPointsInx2].actionName != NULL )
            snprintf( mymsg, MAX_NAME_LEN, "Breakpoint %i  set at %s\n", breakPointsInx2,
                      breakPoints[breakPointsInx2].actionName );
        else {
            snprintf( mymsg, MAX_NAME_LEN, "Cannot set breakpoint, source not available\n" );
        }
        _writeXMsg( streamId, myhdr, mymsg );
        if ( breakPointsInx <= breakPointsInx2 ) {
            breakPointsInx = breakPointsInx2 + 1;
        }
        cmd = REDEBUG_WAIT;
    }
    OR( Param )
    NEXT_TOKEN_BASIC;
    _writeXMsg( streamId, myhdr, "Unknown parameter type.\n" );
    cmd = REDEBUG_WAIT;
    OR( Param )
    _writeXMsg( streamId, myhdr, "Debugger command \'break\' requires at least one argument.\n" );
    cmd = REDEBUG_WAIT;
    END_TRY( Param )

    OR( DbgCmd )
    TRY( Where )
    TTEXT2( "w", "where" );
    smallW = 1;
    OR( Where )
    TTEXT2( "W", "Where" );
    smallW = 0;
    END_TRY( Where )
    wCnt = 20;
    OPTIONAL_BEGIN( Param )
    TTYPE( TK_INT );
    wCnt = atoi( token->text );
    OPTIONAL_END( Param )
    iLevel = 0;

    i = reDebugStackCurrPtr - 1;
    while ( i >= 0 && wCnt > 0 ) {
        if ( !smallW || ( reDebugPCType( ( RuleEngineEvent ) reDebugStackCurr[i].label ) & 1 ) != 0 ) {
            snprintf( myhdr, HEADER_TYPE_LEN - 1,   "idbug: Level %3i", iLevel );
            char msg[HEADER_TYPE_LEN - 1];
            RuleEngineEventParam param;
            param.ruleIndex = 0;
            param.actionName = reDebugStackCurr[i].step;
            printRuleEngineEventLabel( msg, HEADER_TYPE_LEN - 1, ( RuleEngineEvent ) reDebugStackCurr[i].label, &param );
            _writeXMsg( streamId,  myhdr, msg );
            if ( reDebugStackCurr[i].label != EXEC_ACTION_BEGIN ) {
                iLevel++;
            }
            wCnt--;
        }
        i--;
    }
    OR( DbgCmd )
    TTEXT2( "l", "list" );
    TRY( Param )
    TTEXT2( "r", "rule" );
    TRY( ParamParam )
    TTYPE( TK_TEXT );

    mymsg[0] = '\n';
    mymsg[1] = '\0';
    snprintf( myhdr, HEADER_TYPE_LEN - 1,   "idbug: Listing %s", token->text );
    RuleIndexListNode *node;
    found = 0;
    while ( findNextRule2( token->text, ruleInx, &node ) != NO_MORE_RULES_ERR ) {
        found = 1;
        if ( node->secondaryIndex ) {
            n = node->condIndex->valIndex->len;
            int i;
            for ( i = 0; i < n; i++ ) {
                Bucket *b = node->condIndex->valIndex->buckets[i];
                while ( b != NULL ) {
                    RuleDesc *rd = getRuleDesc( *( int * )b->value );
                    char buf[MAX_RULE_LEN];
                    ruleToString( buf, MAX_RULE_LEN, rd );
                    snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "%i: %s\n%s\n", node->ruleIndex, rd->node->base[0] == 's' ? "<source>" : rd->node->base + 1, buf );
                    b = b->next;
                }
            }
        }
        else {
            RuleDesc *rd = getRuleDesc( node->ruleIndex );
            char buf[MAX_RULE_LEN];
            ruleToString( buf, MAX_RULE_LEN, rd );
            snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "\n  %i: %s\n%s\n", node->ruleIndex, rd->node->base[0] == 's' ? "<source>" : rd->node->base + 1, buf );
        }
        ruleInx ++;
    }
    if ( !found ) {
        snprintf( mymsg, MAX_NAME_LEN, "Rule %s not found\n", token->text );
    }
    _writeXMsg( streamId, myhdr, mymsg );
    cmd = REDEBUG_WAIT;
    OR( ParamParam )
    _writeXMsg( streamId, myhdr, "Debugger command \'list rule\' requires one argument.\n" );
    cmd = REDEBUG_WAIT;
    END_TRY( ParamParam )
    OR( Param )
    TTEXT2( "b", "breakpoints" );
    snprintf( myhdr, HEADER_TYPE_LEN - 1,   "idbug: Listing %s", token->text );
    mymsg[0] = '\n';
    mymsg[1] = '\0';
    for ( i = 0; i < breakPointsInx; i++ ) {
        if ( breakPoints[i].actionName != NULL ) {
            if ( breakPoints[i].base != NULL ) {
                snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "Breaking at BreakPoint %i:%s %s:%d\n", i , breakPoints[i].actionName, breakPoints[i].base[0] == 's' ? "<source>" : breakPoints[i].base + 1, breakPoints[i].line );
            }
            else {
                snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "Breaking at BreakPoint %i:%s\n", i , breakPoints[i].actionName );
            }
        }
    }
    _writeXMsg( streamId, myhdr, mymsg );
    cmd = REDEBUG_WAIT;
    OR( Param )
    TTEXT( "*" );
    snprintf( myhdr, HEADER_TYPE_LEN - 1,   "idbug: Listing %s", token->text );
    Env *cenv = env;
    mymsg[0] = '\n';
    mymsg[1] = '\0';
    found = 0;
    while ( cenv != NULL ) {
        n = cenv->current->size;
        for ( i = 0; i < n; i++ ) {
            Bucket *b = cenv->current->buckets[i];
            while ( b != NULL ) {
                if ( b->key[0] == '*' ) { /* skip none * variables */
                    found = 1;
                    char typeString[128];
                    typeToString( ( ( Res * )b->value )->exprType, NULL, typeString, 128 );
                    snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "%s of type %s\n", b->key, typeString );
                }
                b = b->next;
            }
        }
        cenv = cenv->previous;
    }
    if ( !found ) {
        snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "<empty>\n" );
    }
    _writeXMsg( streamId, myhdr, mymsg );
    cmd = REDEBUG_WAIT;
    OR( Param )
    syncTokenQueue( e, context );
    skipWhitespace( e );
    ABORT( lookAhead( e, 0 ) != '$' );
    snprintf( myhdr, HEADER_TYPE_LEN - 1,   "idbug: Listing %s", token->text );
    mymsg[0] = '\n';
    mymsg[1] = '\0';
    Hashtable *vars = newHashTable( 100 );
    for ( i = 0; i < coreRuleVarDef .MaxNumOfDVars; i++ ) {
        if ( lookupFromHashTable( vars, coreRuleVarDef.varName[i] ) == NULL ) {
            snprintf( &mymsg[strlen( mymsg )], MAX_NAME_LEN - strlen( mymsg ), "$%s\n", coreRuleVarDef.varName[i] );
            insertIntoHashTable( vars, coreRuleVarDef.varName[i], coreRuleVarDef.varName[i] );
        }
    }
    deleteHashTable( vars, NULL );
    _writeXMsg( streamId, myhdr, mymsg );
    cmd = REDEBUG_WAIT;
    OR( Param )
    NEXT_TOKEN_BASIC;
    _writeXMsg( streamId, myhdr, "Unknown parameter type.\n" );
    cmd = REDEBUG_WAIT;
    OR( Param )
    _writeXMsg( streamId, myhdr, "Debugger command \'list\' requires at least one argument.\n" );
    cmd = REDEBUG_WAIT;
    END_TRY( Param )
    OR( DbgCmd )
    TTEXT2( "c", "continue" );
    cmd = REDEBUG_STEP_CONTINUE;
    OR( DbgCmd )
    TTEXT2( "C", "Continue" );
    cmd = REDEBUG_CONTINUE_VERBOSE;
    OR( DbgCmd )
    TTEXT2( "del", "delete" );
    TRY( Param )
    TTYPE( TK_INT );
    n = atoi( token->text );
    if ( breakPoints[n].actionName != NULL ) {
        free( breakPoints[n].actionName );
        if ( breakPoints[n].base != NULL ) {
            free( breakPoints[n].base );
        }
        breakPoints[n].actionName = NULL;
        breakPoints[n].base = NULL;
        snprintf( mymsg, MAX_NAME_LEN, "Breakpoint %i  deleted\n", n );
    }
    else {
        snprintf( mymsg, MAX_NAME_LEN, "Breakpoint %i  has not been defined\n", n );
    }
    _writeXMsg( streamId, myhdr, mymsg );
    cmd = REDEBUG_WAIT;
    OR( Param )
    _writeXMsg( streamId, myhdr, "Debugger command \'delete\' requires one argument.\n" );
    cmd = REDEBUG_WAIT;
    END_TRY( Param )
    OR( DbgCmd )
    TTEXT2( "p", "print" );
    Node *n = parseTermRuleGen( e, 1, context );
    if ( getNodeType( n ) == N_ERROR ) {
        errMsgToString( context->errmsg, mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ) );
    }
    else {
        snprintf( myhdr, HEADER_TYPE_LEN - 1,   "idbug: Printing " );
        char * ptr = myhdr + strlen( myhdr );
        i = HEADER_TYPE_LEN - 1 - strlen( myhdr );
        termToString( &ptr, &i, 0, MIN_PREC, n, 0 );
        snprintf( ptr, i, "\n" );
        if ( env != NULL ) {
            disableReDebugger( grdf );
            res = computeNode( n, NULL, regionRegionCpEnv( env, r, ( RegionRegionCopyFuncType * ) regionRegionCpNode ), rei, 0, &errmsg, r );
            enableReDebugger( grdf );
            outStr = convertResToString( res );
            snprintf( mymsg, MAX_NAME_LEN, "%s\n", outStr );
            free( outStr );
            if ( getNodeType( res ) == N_ERROR ) {
                errMsgToString( &errmsg, mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ) );
            }
        }
        else {
            snprintf( mymsg, MAX_NAME_LEN, "Runtime environment: <empty>\n" );
        }
    }
    _writeXMsg( streamId, myhdr, mymsg );

    cmd = REDEBUG_WAIT;
    OR( DbgCmd )
    TTEXT2( "d", "discontinue" );
    cmd = REDEBUG_WAIT;
    OR( DbgCmd )
    snprintf( mymsg, MAX_NAME_LEN, "Unknown Action: %s", readmsg );
    _writeXMsg( streamId, myhdr, mymsg );
    cmd = REDEBUG_WAIT;
    END_TRY( DbgCmd )
    PARSER_END( DbgCmd )
    freeRErrorContent( &errmsg );
    region_free( r );
    deletePointer( e );
    free( context );
    return cmd;
}
Пример #23
0
struct list *phase4(struct hash_table *macros, struct list *input){
	struct list *output;
	struct list *line;
	struct pptoken *token;
	struct pptoken *la1;
	struct pptoken *la2;
	struct pptoken *la3;
	struct pptoken *la4;
	int name;

	output = newList();
	assert(output != NULL);

	la1 = lookAhead(input, 0);
	la2 = lookAhead(input, 1);
	la3 = lookAhead(input, 2);
	la4 = lookAhead(input, 3);

	while(listItemCount(input) > 0){
		if(isDirectiveLine(la1, la2)){
			name = la2->name;
			line = newList();
			assert(line != NULL);

			do {
				listDequeue(input, (void**)&token);
				listEnqueue(line, token);
				la1 = lookAhead(input, 0);
			} while(!la1->startsLine);


			if(name){
				if(name == PPTN_IF){
				} else if(name == PPTN_IFDEF){
				} else if(la2->name == PPTN_IFNDEF){
				} else if(la2->name == PPTN_ELIF){
				} else if(la2->name == PPTN_ELSE){
				} else if(la2->name == PPTN_ENDIF){
				} else if(la2->name == PPTN_INCLUDE){
				} else if(la2->name == PPTN_DEFINE){
					defineLine(macros, line);
				} else if(la2->name == PPTN_UNDEF){
				} else if(la2->name == PPTN_LINE){
				} else if(la2->name == PPTN_ERROR){
				} else if(la2->name == PPTN_PRAGMA){
				} else {
				}
			}
		} else {
			la1 = lookAhead(input, 0);
			do{
				if(la1->name == PPTN_IDENTIFIER){
					while(tryExpandingMacros(macros, input))
						;
				}
				listDequeue(input, (void**)&token);
				listEnqueue(output, token);
				la1 = lookAhead(input, 0);
			}while(!la1->startsLine);
		}

		la1 = lookAhead(input, 0);
		la2 = lookAhead(input, 1);
		la3 = lookAhead(input, 2);
		la4 = lookAhead(input, 3);
	}
	return output;
}
Пример #24
0
void XtgScanner::definePStyles()
{
	QString s1,s2,s3;
	enterState(stringMode);
	define = 2;
	top=top+1;//skip the inch
	s1 = getToken();//will contain the string 1
	top=top+2;//we have to skip comma and next inch character
	s2 = getToken();
	if (lookAhead() != ']' )
	{
		top = top+2;
		s3 = getToken();
	}
	top++; // to ensure that ] is avoided
	
	/** Type 1 definition of Paragraph Stylesheet. Refer Documentation for details
	*/
	if (s1=="" && s2=="" && s3=="")
	{
		//define paragraph stylesheet with default character attributes
		defParagraphStyle.setParent("");
		defParagraphStyle.charStyle().setParent("Default Character Style");
	}
	
	/** Type 2 definition of Paragraph Stylesheet. Refer Documentation for details
	*/
	else if (s1=="" && s2=="" && s3!="")
	{
		//define paragraphstyle with character style whose name is in s3
		defParagraphStyle.setParent("");
		if(styleStatus(definedCStyles,s3))
			defParagraphStyle.charStyle().setParent(s3);
		else
		{
			showWarning(s3);
			defParagraphStyle.charStyle().setParent("Default Character Style");
		}
	}

	/** Type 3 definition of Paragraph Stylesheet. Refer Documentation for details
	*/
	else if (s1 != "" && s2 != "" && s3 != "")
	{
		if (styleStatus(definedStyles, s1) )
			defParagraphStyle.setParent(s1);
		else
		{
			showWarning(s1);
			defParagraphStyle.setParent("Default Paragraph Style");
		}
		/** s2 is the next paragraph style which is to be applied, but this cannot be done at moment in Scribus 
		*/
		currentParagraphStyle = writer->getCurrentStyle();
		currentCharStyle = currentParagraphStyle.charStyle();
		defParagraphStyle.charStyle().setParent(s3);
	}
	else
	{
		//generate error : parser error
	}
	enterState(textMode);
}
Пример #25
0
static int defineLine(struct hash_table *macros, struct list *line){
	struct pptoken *token;
	struct pptoken *macroName;
	struct list *identifierList;
	struct list *replacementList;
	struct pptoken *la1;
	struct pptoken *la2;
	struct pptoken *la3;
	struct pptoken *la4;

	la1 = lookAhead(line, 0);
	la2 = lookAhead(line, 1);
	la3 = lookAhead(line, 2);
	la4 = lookAhead(line, 3);

	if(la1->name != PPTN_HASH || !la1->startsLine){
		fprintf(stderr, "define line missing '#'\n");
		exit(1);
	}
	if(la2->name != PPTN_DEFINE){
		fprintf(stderr, "define line missing 'define' keyword\n");
		exit(1);
	}
	if(la3->name != PPTN_IDENTIFIER){
		fprintf(stderr, "define line expected identifier\n");
		exit(1);
	}

	if(la4->name == PPTN_LPAREN && strlen(la4->whiteSpace) == 0){
		identifierList = newList();
		assert(identifierList != NULL);
		listDequeue(line, NULL); // #
		listDequeue(line, NULL); // define
		listDequeue(line, (void**)&macroName);
		listDequeue(line, NULL); // (

		la1 = lookAhead(line, 0);
		la2 = lookAhead(line, 1);

		while(la1->name == PPTN_IDENTIFIER){
			listDequeue(line, (void**)&token);
			listEnqueue(identifierList, token);
			if(la2->name == PPTN_COMMA){
				listDequeue(line, NULL);
			}
			la1 = lookAhead(line, 0);
			la2 = lookAhead(line, 1);
		}
		if(la1->name == PPTN_RPAREN){
			listDequeue(line, NULL);
		} else if(la1->name == PPTN_PERIOD_PERIOD_PERIOD && la2->name == PPTN_RPAREN){
			listDequeue(line, NULL);
			listDequeue(line, NULL);
		} else {
			fprintf(stderr, "function macro expected ')' or \"...)\"\n");
			exit(1);
		}
		replacementList = line;
	} else {
		struct macro *macro;
		int found;
		listDequeue(line, NULL); // #
		listDequeue(line, NULL); // define
		listDequeue(line, (void**)&macroName);
		replacementList = line;

		hashTableGetValue(macros, macroName->lexeme, (void**)&macro, &found);
		if(found){
			fprintf(stderr, "define line replacemnt not impllemented\n");
			exit(1);
		} else {
			macro = calloc(1, sizeof(*macro));
			assert(macro != NULL);
			macro->macroName = macroName->lexeme;
			macro->isFunctionMacro = 0;
			macro->identifierList = NULL;
			macro->replacementList = replacementList;
			hashTableSetValue(macros, macro->macroName, macro);
		}
	}
	return 0;
}
Пример #26
0
void XtgScanner::definePStyles()
{
	QString s1,s2,s3;
	enterState(stringMode);
	define = 2;
	if (token == "[S\"")
		s1 = getToken();
	else
	{
		while (lookAhead() != '\"')
			top++;					//skip the inch
		top++;
		s1 = getToken();			//will contain the string 1
	}
//	top = top + 2;				//we have to skip comma and next inch character
	while (lookAhead() != '\"')
		top++;
	top++;
	s2 = getToken();
	if (lookAhead() != ']' )
	{
		while (lookAhead() != '\"')
			top++;
		top++;
	//	top = top + 2;
		s3 = getToken();
	}
	top++; // to ensure that ] is avoided
	QString pStyle = CommonStrings::DefaultParagraphStyle;
	ParagraphStyle newStyle;
	if (s1 != "")
	{
		if (doc->paragraphStyles().contains(m_item->itemName() + "_" + s1))
			newStyle.setParent(m_item->itemName() + "_" + s1);
		else if  (doc->paragraphStyles().contains(s1))
			newStyle.setParent(s1);
		else
			newStyle.setParent(pStyle);
	}
	else
		newStyle.setParent(pStyle);
	if (m_prefixName)
		newStyle.setName(m_item->itemName() + "_" + sfcName);
	else
		newStyle.setName((sfcName));
	newStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
	if (s3 != "")
	{
		if (doc->charStyles().contains(m_item->itemName() + "_" + s3))
			newStyle.charStyle().setParent(m_item->itemName() + "_" + s3);
		else if  (doc->charStyles().contains(s3))
			newStyle.charStyle().setParent(s3);
		else
			newStyle.charStyle().setParent(CommonStrings::DefaultCharacterStyle);
	}
	else
	{
		newStyle.charStyle().setParent(CommonStrings::DefaultCharacterStyle);
		newStyle.charStyle().setFontSize(120.0);
		styleEffects = ScStyle_None;
		newStyle.charStyle().setFeatures(styleEffects.featureList());
	}
	currentParagraphStyle = newStyle;
	currentCharStyle = newStyle.charStyle();
	enterState(textMode);
}
Пример #27
0
void XtgScanner::xtgParse()
{
	/* Enter the default mode as textMode */
	enterState(textMode);
	currentParagraphStyle.setParent(CommonStrings::DefaultParagraphStyle);
	currentParagraphStyle.charStyle().setParent(CommonStrings::DefaultCharacterStyle);
	currentParagraphStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
	currentCharStyle = currentParagraphStyle.charStyle();
	while (lookAhead() != '\0')
	{
		token = getToken();
		QHash<QString,void (XtgScanner::*)(void)> *temp = NULL;
		if (Mode == tagMode)
			temp = &tagModeHash;
		else if (Mode == nameMode)
			temp = &nameModeHash;
		else if (Mode == textMode)
			temp = &textModeHash;
		if (temp->contains(token) )
		{
			funPointer = temp->value(token);
			(this->*funPointer)();
		}

		/**
				Various character Style Applications <@stylesheetname>. We cannot hash this since stylesheetname
				is not constant
				*/

		else if ( (currentState() == tagMode ) && token.startsWith('@') && token.endsWith('>') )
		{
			/*here we receive a token @stylesheetname>, hence we have to slice of token to 
				get the name of character stylesheet to be applied
			*/
			define = 0;
			sfcName = token.remove(0,1);
			sfcName = sfcName.remove(sfcName.size()-1,1);
			flushText();
		//	if (styleStatus(definedCStyles,sfcName))
		//		writer->setCharStyle(sfcName);
		//	else
		//	{
		//		showWarning(sfcName);
		//		writer->setCharStyle("");
		//	}
		//	currentCharStyle = writer->getCurrentCharStyle();
		}
		if (top >= input_Buffer.length())
			break;
	}
	if (!textToAppend.isEmpty())
	{
		textToAppend.replace(QChar(10), SpecialChars::LINEBREAK);
		textToAppend.replace(QChar(12), SpecialChars::FRAMEBREAK);
		textToAppend.replace(QChar(30), SpecialChars::NBHYPHEN);
		textToAppend.replace(QChar(160), SpecialChars::NBSPACE);
		ParagraphStyle newStyle;
		newStyle.setParent(currentParagraphStyle.name());
		int posC = m_item->itemText.length();
		m_item->itemText.insertChars(posC, textToAppend);
		m_item->itemText.applyStyle(posC, newStyle);
		m_item->itemText.applyCharStyle(posC, textToAppend.length(), currentCharStyle);
	}
//	qDebug()<<"Unsupported : "<<unSupported;
}
Пример #28
0
  void MetaParser::consumeToken() {
    if (m_TokenCache.size())
      m_TokenCache.erase(m_TokenCache.begin());

    lookAhead(0);
  }
Пример #29
0
QString XtgScanner::getToken()
{
	QChar temp;
	QString token;
	temp = lookAhead();
	if (currentState() == textMode)
	{
		/**
		This mode should return only '<' or '@' or newline. It also adds the text_to_be_appended to the QString textToAppend
		*/
		if (temp =='<' || temp =='@' || temp == '\n' || temp == '\r')
			token.append( nextSymbol() );
		else if (temp == '\\')
		{
			/**
			An escape sequence is occurred, hence we will just append 
			the next character in buffer to the text. This will automatically
			deal the occurrance of '\@' or '\:' or any other relevant escapes
			*/
			top = top+1;
			textToAppend.append( nextSymbol() );
		}
		else
			textToAppend.append( nextSymbol() );
	}
	
	if (currentState() == tagMode)
	{
		/**
		This mode should return attributes B|I|U|O|....|*L|*C|... and an inch character "
		*/
		if (temp == '@')
		{
			token.append( nextSymbol() ); // this will append @
			if (lookAhead() == '$')
			{
				token.append( nextSymbol() ); //this will result in @$ if $ is found
				if (lookAhead() == 'p' )
					token.append( nextSymbol() ); //this will result in @$p if p is found
			}
			else // to get the name of character stylesheet applied as <@stylesheetname>
			{
				while (lookAhead() != '>' )
					token.append( nextSymbol() );
				token.append('>');
			}
		}
		else if (temp == '*')
		{
			token.append( nextSymbol() );
			if (lookAhead() == 'r' || lookAhead() == 'k')
			{
				token.append( nextSymbol() );
				token.append( nextSymbol() );
			}
			else
				token.append( nextSymbol() );
		}
		else if (temp == '\\' )
		{
			/** append the * character and the nextSymbol to token so as to form a paragraph attribute and '\\' character to deal special characters that contain XPress Tags codes.
			*/
			token.append( nextSymbol() );
			token.append( nextSymbol() ); 
		}
		else if (temp == '\"')
		{
			/**If inch character is found, the scanner should enter the string mode and enter the corresponding string as the token
			*/
			enterState(stringMode);
			top = top+1;
			token = getToken();
			enterState( previousState() );
		} 
		else if (temp.isDigit())
		{
			while (lookAhead().isDigit() )
			{
				token.append( nextSymbol() );
				if (lookAhead() == '.' )
					token.append( nextSymbol() );
			}
		}
		else if (temp == 'A')
		{
			token.append(nextSymbol());
		}
		else if (temp == 'a')
		{
			token.append( nextSymbol() );
			//look for $ or $$ so as to form the token a$ and a$$
			token.append( getToken() );
		}
		else if (temp == '$') //look for tags like $,$$ etc
		{
			token.append( nextSymbol() );
			//check for existence one more $
			if (lookAhead() == '$' )
				token.append( nextSymbol() );
		}
		else if (temp == '>')
			token.append( nextSymbol() );
		else if (temp == '(')
		{
			top = top+1;
			token = getToken();
		}
		else if (temp == ',')
		{
			top = top+1;
			token=getToken();
		}
		else 
			token.append( nextSymbol() );
	}

	if (currentState() == nameMode)
	{
		/**
		This mode should return the name of stylesheet (or font set or color) or '=' or ':','[' etc. This mode works with the assumption that a character '@' have occurred prior to it.Hence inorder to obtain the tags like '@$:' or '@:' ,we will append @ symbol initially to the token.
		*/
		if ( (input_Buffer.at(top-1)=='@') && (temp == ':') ) // get the simplest token @
		{
			token.append('@');
		}
		else if ( (input_Buffer.at(top-1)=='@') && (temp == '$') ) //get the token @$
		{
			token.append('@');
			token.append( nextSymbol() );
		}
		else if (temp == '\"' )
		{
			enterState(stringMode);
			top = top+1;
			token = getToken();
			enterState( previousState() );
		}
		else if (temp == ',' )
			top = top+1;
		else if (temp == '[' )
		{
			//return [F] or [C] or [Sp or [St
			token.append( nextSymbol() );
			if (lookAhead() == 'F' || lookAhead() == 'C' || lookAhead() == 'S')
			{
				token.append( nextSymbol() );
				token.append( nextSymbol() ); //append ]
			}
		}
		else if (lookAhead() == '=')
			token.append( nextSymbol() );
		else if (lookAhead() == ':')
			token.append( nextSymbol() );
		else if (lookAhead() == '<')
		{
			token.append( nextSymbol() );
		}
		else
		{ // find the name and return it as a tag
			while( 1 )
			{
				temp = lookAhead();
				if (temp == ':' || temp == '=' )
					break;
				token.append( input_Buffer.at(top++) );
			}
		}
	}
	
	if ( currentState() == stringMode )
	{
		/* This mode should return those strings which are inside an inch character, while in tagMode. Hence this should set the mode to tagMode before returning the string value. This will call a function QString sliceString() which will return the required string and maintains the top correctly
		*/
		token = sliceString();
	}
	return token;
}
Пример #30
0
void XtgScanner::setPRuleBelow()
{
	unSupported.append(token);
	while (lookAhead() != '>')
		top = top+1;
}