Click here to Skip to main content
14,547,011 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch25-Dec-19 1:53
mvahoney the codewitch25-Dec-19 1:53 
AnswerRe: anyone have any ideas for this problem? Pin
Greg Utas25-Dec-19 2:18
professionalGreg Utas25-Dec-19 2:18 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch25-Dec-19 2:25
mvahoney the codewitch25-Dec-19 2:25 
GeneralRe: anyone have any ideas for this problem? Pin
Greg Utas25-Dec-19 2:45
professionalGreg Utas25-Dec-19 2:45 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch25-Dec-19 2:46
mvahoney the codewitch25-Dec-19 2:46 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch25-Dec-19 2:51
mvahoney the codewitch25-Dec-19 2:51 
GeneralRe: anyone have any ideas for this problem? Pin
Greg Utas25-Dec-19 3:09
professionalGreg Utas25-Dec-19 3:09 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch25-Dec-19 3:12
mvahoney the codewitch25-Dec-19 3:12 
I already do that in my hand written parser

// possibly a cast, or possibly a subexpression
// we can't know for sure so this gets *really* complicated
// basically we need to backtrack.
CodeExpression expr = null;
var pc2 = pc.GetLookAhead();
pc2.EnsureStarted();
try
{
	expr = _ParseCast(pc2);
}
catch { }
if(null!=expr)
{
	// now advance our actual pc
	// TODO: see if we can't add a dump feature
	// to the lookahead so we don't have to 
	// parse again. Minor, but sloppy.
	return _ParseCast(pc);

} else
{
	try
	{
		if (!pc.Advance())
			_Error("Unterminated cast or subexpression", pc.Current);
		expr=_ParseExpression(pc);
		_SkipComments(pc);
		if(ST.rparen!=pc.SymbolId)
			_Error("Invalid cast or subexpression", pc.Current);
		pc.Advance();
		return expr;
	}
	catch(Exception eex)
	{
		throw eex;
	}
}


Ironically that TODO: is already handled by my generated parser (it counts tokens and dumps lookahead) but the above works.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

AnswerRe: anyone have any ideas for this problem? Pin
Super Lloyd25-Dec-19 3:00
MemberSuper Lloyd25-Dec-19 3:00 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch25-Dec-19 3:03
mvahoney the codewitch25-Dec-19 3:03 
GeneralRe: anyone have any ideas for this problem? Pin
Super Lloyd25-Dec-19 3:12
MemberSuper Lloyd25-Dec-19 3:12 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch25-Dec-19 3:14
mvahoney the codewitch25-Dec-19 3:14 
AnswerRe: anyone have any ideas for this problem? Pin
0x01AA25-Dec-19 3:36
mve0x01AA25-Dec-19 3:36 
AnswerRe: anyone have any ideas for this problem? Pin
PIEBALDconsult25-Dec-19 5:41
professionalPIEBALDconsult25-Dec-19 5:41 
AnswerRe: anyone have any ideas for this problem? Pin
Jon McKee25-Dec-19 19:28
professionalJon McKee25-Dec-19 19:28 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch25-Dec-19 19:51
mvahoney the codewitch25-Dec-19 19:51 
AnswerRe: anyone have any ideas for this problem? Pin
Dan Sutton27-Dec-19 9:19
MemberDan Sutton27-Dec-19 9:19 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch28-Dec-19 0:02
mvahoney the codewitch28-Dec-19 0:02 
AnswerRe: anyone have any ideas for this problem? Pin
Member 1458241528-Dec-19 3:47
MemberMember 1458241528-Dec-19 3:47 
GeneralRe: anyone have any ideas for this problem? Pin
honey the codewitch28-Dec-19 3:57
mvahoney the codewitch28-Dec-19 3:57 
GeneralRe: anyone have any ideas for this problem? Pin
Member 1458241528-Dec-19 7:28
MemberMember 1458241528-Dec-19 7:28 
GeneralToday, 20 years ago Pin
Mark_Wallace24-Dec-19 21:47
MemberMark_Wallace24-Dec-19 21:47 
GeneralRe: Today, 20 years ago Pin
RickZeeland24-Dec-19 22:22
mveRickZeeland24-Dec-19 22:22 
GeneralRe: Today, 20 years ago Pin
Mark_Wallace26-Dec-19 1:23
MemberMark_Wallace26-Dec-19 1:23 
GeneralRe: Today, 20 years ago Pin
RickZeeland26-Dec-19 2:54
mveRickZeeland26-Dec-19 2:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.