Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
119 lines (103 sloc) 3.2 KB
public TokenList getSourceTokenUntil(String... any) {
LinkedList<Token> queue = new LinkedList<Token>();
while (true) {
Token token = getSourceToken();
if (token == null || token.length() == 0)
break;
queue.add(token);
for (String s : any) {
if (token.equals(s)) {
return new TokenList(queue);
}
}
}
return new TokenList(queue);
}
---
if( mytype.nativeClass instanceof RayInteger )
{
RayInteger ri = (RayInteger) mytype.nativeClass;
ri.setIntValue(Long.parseLong(value.s()));
} else if( mytype.nativeClass instanceof RayString && value.length() > 0)
{
RayInteger ri = (RayInteger) mytype.nativeClass;
ri.setStringValue(value.s().substring(1,value.length()-2)); // remove quotes
}
---
RayMethod method = rayVar.getType().getMethod(methodName.s());
if (method == null) {
RayLog.warn("methodName.s() " + rayVar.getInstance() + " " + methodName.s());
RayUtils.runtimeExcp("fuu");
}
---
/**
RaySource rsrc = new RaySource();
rsrc.src = ta.getText().toCharArray();
int i=0;
while (true)
{
i++;
RayString rs = RayUtils.getSourceToken(rsrc);
if (rs == null || i>100)
break;
RayLog.log("'"+rs+"'");
}
*/
---
/*
private RayString getToken2()
{
int start, end;
if (src[pos] == ';') // ende
{
// kill following ; \r \n ' ';
while ((pos < src.length) && ((src[pos] == ' ') || (src[pos] == '\t')))
pos++;
}
else if ((pos < src.length) && ((src[pos] == '\n') || (src[pos] == '\r')))
{
}
else if (src[pos] == 'a') // var oder ident
{
// kill following ; \r \n;
}
else if (src[pos] == '1') // nr anf
{
// kill following ; \r \n;
}
while ((pos < src.length) && ((src[pos] == '\n') || (src[pos] == '\r')))
pos++;
int p= pos;
while (true)
{
if (p >= src.length)
if (p == pos)
return null;
else
{
p--;
break;
}
if (src[p] == ';')
break;
p++;
}
int pp= pos;
pos= p + 1;
// RayLog.log( pp + " " + pos);
return new RayString(src, pp, p);
}
*/
---
from RayMethod:
protected RayVar makeARayVar(RayClass rayClass, String varType, String varName, String instanceType, List<RayClassInterface> params) {
RayClassInterface varTypeClass = RayLang.instance.getClass(varType);
if (varTypeClass == null)
RayUtils.runtimeExcp(varType + " not found");
RayClassInterface instanceTypeClass = RayLang.instance.getClass(instanceType);
RayUtils.assert_(instanceTypeClass == varTypeClass, instanceTypeClass + " != " + varTypeClass); // check for inhertiance ? // TODO: check using equals ?
Visibility v = Visibility.protected_;
RayVar rayVar = new RayVar(v, varType, varName);
rayVar.setValue(instanceTypeClass.getNewInstance(params));
return rayVar;
}
You can’t perform that action at this time.