Mercurial > hg > tema
changeset 18:d53cd4995bd4
Remember the return code of the last parsed instruction.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Thu, 26 Mar 2009 17:18:31 +0300 |
parents | 5ebf123f3486 |
children | 7b11f5174e29 |
files | src/kryshen/tema/TemplateParser.java |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/kryshen/tema/TemplateParser.java Tue Mar 24 19:36:09 2009 +0300 +++ b/src/kryshen/tema/TemplateParser.java Thu Mar 26 17:18:31 2009 +0300 @@ -106,7 +106,8 @@ }; protected final Context context; - + + private int lastReturnCode = 0; private int termBracket = -1; public TemplateParser() { @@ -183,7 +184,9 @@ int tb = termBracket; termBracket = openBracket; - result.retCode += Math.abs(parseFunction(in, out, format)); + int returnCode = Math.abs(parseFunction(in, out, format)); + lastReturnCode = returnCode; + result.retCode += returnCode; result.empty = false; termBracket = tb; @@ -414,7 +417,7 @@ return r; } - + public int invoke(String name, FunctionDataParser fdp, Writer out) throws IOException, TemplateException { Object value = context.get(name); @@ -436,7 +439,11 @@ return parseValue(value, out); } - + + public int getLastReturnCode() { + return lastReturnCode; + } + public Context getContext() { return context; }