lazutils: xpath: renamed resourcestrings

git-svn-id: trunk@40277 -
This commit is contained in:
mattias 2013-02-12 10:35:46 +00:00
parent efee6e8c99
commit 51e06df26e
4 changed files with 311 additions and 71 deletions

View File

@ -1,83 +1,203 @@
msgid "" msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8" msgstr "Content-Type: text/plain; charset=UTF-8"
#: laz2_xpath.lrsboolean
msgctxt "laz2_xpath.lrsboolean"
msgid "boolean"
msgstr ""
#: laz2_xpath.lrsevalinvalidargcount
msgctxt "laz2_xpath.lrsevalinvalidargcount"
msgid "Invalid number of function arguments"
msgstr ""
#: laz2_xpath.lrsevalunknownfunction
msgctxt "laz2_xpath.lrsevalunknownfunction"
msgid "Unknown function: \"%s\""
msgstr ""
#: laz2_xpath.lrsevalunknownvariable
msgctxt "laz2_xpath.lrsevalunknownvariable"
msgid "Unknown variable: \"%s\""
msgstr ""
#: laz2_xpath.lrsnodeset
msgctxt "laz2_xpath.lrsnodeset"
msgid "node set"
msgstr ""
#: laz2_xpath.lrsnumber
msgctxt "laz2_xpath.lrsnumber"
msgid "number"
msgstr ""
#: laz2_xpath.lrsparserbadaxisname
msgctxt "laz2_xpath.lrsparserbadaxisname"
msgid "Invalid axis name"
msgstr ""
#: laz2_xpath.lrsparserbadnodetype
msgctxt "laz2_xpath.lrsparserbadnodetype"
msgid "Invalid node type"
msgstr ""
#: laz2_xpath.lrsparserexpectedleftbracket
msgctxt "laz2_xpath.lrsparserexpectedleftbracket"
msgid "Expected \"(\""
msgstr ""
#: laz2_xpath.lrsparserexpectedrightbracket
msgctxt "laz2_xpath.lrsparserexpectedrightbracket"
msgid "Expected \")\""
msgstr ""
#: laz2_xpath.lrsparserexpectedrightsquarebracket
msgctxt "laz2_xpath.lrsparserexpectedrightsquarebracket"
msgid "Expected \"]\" after predicate"
msgstr ""
#: laz2_xpath.lrsparsergarbageafterexpression
msgctxt "laz2_xpath.lrsparsergarbageafterexpression"
msgid "Unrecognized input after expression"
msgstr ""
#: laz2_xpath.lrsparserinvalidnodetest
msgctxt "laz2_xpath.lrsparserinvalidnodetest"
msgid "Invalid node test (syntax error)"
msgstr ""
#: laz2_xpath.lrsparserinvalidprimexpr
msgctxt "laz2_xpath.lrsparserinvalidprimexpr"
msgid "Invalid primary expression"
msgstr ""
#: laz2_xpath.lrsscannerexpectedvarname
msgctxt "laz2_xpath.lrsscannerexpectedvarname"
msgid "Expected variable name after \"$\""
msgstr ""
#: laz2_xpath.lrsscannerinvalidchar
msgctxt "laz2_xpath.lrsscannerinvalidchar"
msgid "Invalid character"
msgstr ""
#: laz2_xpath.lrsscannermalformedqname
msgctxt "laz2_xpath.lrsscannermalformedqname"
msgid "Expected \"*\" or local part after colon"
msgstr ""
#: laz2_xpath.lrsscannerunclosedstring
msgctxt "laz2_xpath.lrsscannerunclosedstring"
msgid "String literal was not closed"
msgstr ""
#: laz2_xpath.lrsstring
msgctxt "laz2_xpath.lrsstring"
msgid "string"
msgstr ""
#: laz2_xpath.lrsvarnoconversion
msgctxt "laz2_xpath.lrsvarnoconversion"
msgid "Conversion from %s to %s not possible"
msgstr ""
#: laz2_xpath.sboolean #: laz2_xpath.sboolean
msgctxt "laz2_xpath.sboolean"
msgid "boolean" msgid "boolean"
msgstr "" msgstr ""
#: laz2_xpath.sevalinvalidargcount #: laz2_xpath.sevalinvalidargcount
msgctxt "laz2_xpath.sevalinvalidargcount"
msgid "Invalid number of function arguments" msgid "Invalid number of function arguments"
msgstr "" msgstr ""
#: laz2_xpath.sevalunknownfunction #: laz2_xpath.sevalunknownfunction
msgctxt "laz2_xpath.sevalunknownfunction"
msgid "Unknown function: \"%s\"" msgid "Unknown function: \"%s\""
msgstr "" msgstr ""
#: laz2_xpath.sevalunknownvariable #: laz2_xpath.sevalunknownvariable
msgctxt "laz2_xpath.sevalunknownvariable"
msgid "Unknown variable: \"%s\"" msgid "Unknown variable: \"%s\""
msgstr "" msgstr ""
#: laz2_xpath.snodeset #: laz2_xpath.snodeset
msgctxt "laz2_xpath.snodeset"
msgid "node set" msgid "node set"
msgstr "" msgstr ""
#: laz2_xpath.snumber #: laz2_xpath.snumber
msgctxt "laz2_xpath.snumber"
msgid "number" msgid "number"
msgstr "" msgstr ""
#: laz2_xpath.sparserbadaxisname #: laz2_xpath.sparserbadaxisname
msgctxt "laz2_xpath.sparserbadaxisname"
msgid "Invalid axis name" msgid "Invalid axis name"
msgstr "" msgstr ""
#: laz2_xpath.sparserbadnodetype #: laz2_xpath.sparserbadnodetype
msgctxt "laz2_xpath.sparserbadnodetype"
msgid "Invalid node type" msgid "Invalid node type"
msgstr "" msgstr ""
#: laz2_xpath.sparserexpectedleftbracket #: laz2_xpath.sparserexpectedleftbracket
msgctxt "laz2_xpath.sparserexpectedleftbracket"
msgid "Expected \"(\"" msgid "Expected \"(\""
msgstr "" msgstr ""
#: laz2_xpath.sparserexpectedrightbracket #: laz2_xpath.sparserexpectedrightbracket
msgctxt "laz2_xpath.sparserexpectedrightbracket"
msgid "Expected \")\"" msgid "Expected \")\""
msgstr "" msgstr ""
#: laz2_xpath.sparserexpectedrightsquarebracket #: laz2_xpath.sparserexpectedrightsquarebracket
msgctxt "laz2_xpath.sparserexpectedrightsquarebracket"
msgid "Expected \"]\" after predicate" msgid "Expected \"]\" after predicate"
msgstr "" msgstr ""
#: laz2_xpath.sparsergarbageafterexpression #: laz2_xpath.sparsergarbageafterexpression
msgctxt "laz2_xpath.sparsergarbageafterexpression"
msgid "Unrecognized input after expression" msgid "Unrecognized input after expression"
msgstr "" msgstr ""
#: laz2_xpath.sparserinvalidnodetest #: laz2_xpath.sparserinvalidnodetest
msgctxt "laz2_xpath.sparserinvalidnodetest"
msgid "Invalid node test (syntax error)" msgid "Invalid node test (syntax error)"
msgstr "" msgstr ""
#: laz2_xpath.sparserinvalidprimexpr #: laz2_xpath.sparserinvalidprimexpr
msgctxt "laz2_xpath.sparserinvalidprimexpr"
msgid "Invalid primary expression" msgid "Invalid primary expression"
msgstr "" msgstr ""
#: laz2_xpath.sscannerexpectedvarname #: laz2_xpath.sscannerexpectedvarname
msgctxt "laz2_xpath.sscannerexpectedvarname"
msgid "Expected variable name after \"$\"" msgid "Expected variable name after \"$\""
msgstr "" msgstr ""
#: laz2_xpath.sscannerinvalidchar #: laz2_xpath.sscannerinvalidchar
msgctxt "laz2_xpath.sscannerinvalidchar"
msgid "Invalid character" msgid "Invalid character"
msgstr "" msgstr ""
#: laz2_xpath.sscannermalformedqname #: laz2_xpath.sscannermalformedqname
msgctxt "laz2_xpath.sscannermalformedqname"
msgid "Expected \"*\" or local part after colon" msgid "Expected \"*\" or local part after colon"
msgstr "" msgstr ""
#: laz2_xpath.sscannerunclosedstring #: laz2_xpath.sscannerunclosedstring
msgctxt "laz2_xpath.sscannerunclosedstring"
msgid "String literal was not closed" msgid "String literal was not closed"
msgstr "" msgstr ""
#: laz2_xpath.sstring #: laz2_xpath.sstring
msgctxt "laz2_xpath.sstring"
msgid "string" msgid "string"
msgstr "" msgstr ""
#: laz2_xpath.svarnoconversion #: laz2_xpath.svarnoconversion
msgctxt "laz2_xpath.svarnoconversion"
msgid "Conversion from %s to %s not possible" msgid "Conversion from %s to %s not possible"
msgstr "" msgstr ""

View File

@ -10,83 +10,203 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.5.5\n" "X-Generator: Poedit 1.5.5\n"
#: laz2_xpath.lrsboolean
msgctxt "laz2_xpath.lrsboolean"
msgid "boolean"
msgstr "логический тип"
#: laz2_xpath.lrsevalinvalidargcount
msgctxt "laz2_xpath.lrsevalinvalidargcount"
msgid "Invalid number of function arguments"
msgstr "Неверное количество аргументов функции"
#: laz2_xpath.lrsevalunknownfunction
msgctxt "laz2_xpath.lrsevalunknownfunction"
msgid "Unknown function: \"%s\""
msgstr "Неизвестная функция: \"%s\""
#: laz2_xpath.lrsevalunknownvariable
msgctxt "laz2_xpath.lrsevalunknownvariable"
msgid "Unknown variable: \"%s\""
msgstr "Неизвестная переменная: \"%s\""
#: laz2_xpath.lrsnodeset
msgctxt "laz2_xpath.lrsnodeset"
msgid "node set"
msgstr "набор элементов"
#: laz2_xpath.lrsnumber
msgctxt "laz2_xpath.lrsnumber"
msgid "number"
msgstr "числовой тип"
#: laz2_xpath.lrsparserbadaxisname
msgctxt "laz2_xpath.lrsparserbadaxisname"
msgid "Invalid axis name"
msgstr "Некорректное имя оси"
#: laz2_xpath.lrsparserbadnodetype
msgctxt "laz2_xpath.lrsparserbadnodetype"
msgid "Invalid node type"
msgstr "Некорректный тип элемента"
#: laz2_xpath.lrsparserexpectedleftbracket
msgctxt "laz2_xpath.lrsparserexpectedleftbracket"
msgid "Expected \"(\""
msgstr "Ожидается \"(\""
#: laz2_xpath.lrsparserexpectedrightbracket
msgctxt "laz2_xpath.lrsparserexpectedrightbracket"
msgid "Expected \")\""
msgstr "Ожидается \")\""
#: laz2_xpath.lrsparserexpectedrightsquarebracket
msgctxt "laz2_xpath.lrsparserexpectedrightsquarebracket"
msgid "Expected \"]\" after predicate"
msgstr "После предиката ожидается \"]\""
#: laz2_xpath.lrsparsergarbageafterexpression
msgctxt "laz2_xpath.lrsparsergarbageafterexpression"
msgid "Unrecognized input after expression"
msgstr "Неопознанное содержимое после выражения"
#: laz2_xpath.lrsparserinvalidnodetest
msgctxt "laz2_xpath.lrsparserinvalidnodetest"
msgid "Invalid node test (syntax error)"
msgstr "Проверка элемента не удалась (синтаксическая ошибка)"
#: laz2_xpath.lrsparserinvalidprimexpr
msgctxt "laz2_xpath.lrsparserinvalidprimexpr"
msgid "Invalid primary expression"
msgstr "Некорректное первичное выражение"
#: laz2_xpath.lrsscannerexpectedvarname
msgctxt "laz2_xpath.lrsscannerexpectedvarname"
msgid "Expected variable name after \"$\""
msgstr "После \"$\" ожидается имя переменной"
#: laz2_xpath.lrsscannerinvalidchar
msgctxt "laz2_xpath.lrsscannerinvalidchar"
msgid "Invalid character"
msgstr "Некорректный символ"
#: laz2_xpath.lrsscannermalformedqname
msgctxt "laz2_xpath.lrsscannermalformedqname"
msgid "Expected \"*\" or local part after colon"
msgstr "После двоеточия ожидается \"*\" либо локальная часть имени"
#: laz2_xpath.lrsscannerunclosedstring
msgctxt "laz2_xpath.lrsscannerunclosedstring"
msgid "String literal was not closed"
msgstr "Строковый литерал не имеет закрывающего символа"
#: laz2_xpath.lrsstring
msgctxt "laz2_xpath.lrsstring"
msgid "string"
msgstr "строковый тип"
#: laz2_xpath.lrsvarnoconversion
msgctxt "laz2_xpath.lrsvarnoconversion"
msgid "Conversion from %s to %s not possible"
msgstr "Невозможно преобразовать %s в %s"
#: laz2_xpath.sboolean #: laz2_xpath.sboolean
msgctxt "laz2_xpath.sboolean"
msgid "boolean" msgid "boolean"
msgstr "логический тип" msgstr "логический тип"
#: laz2_xpath.sevalinvalidargcount #: laz2_xpath.sevalinvalidargcount
msgctxt "laz2_xpath.sevalinvalidargcount"
msgid "Invalid number of function arguments" msgid "Invalid number of function arguments"
msgstr "Неверное количество аргументов функции" msgstr "Неверное количество аргументов функции"
#: laz2_xpath.sevalunknownfunction #: laz2_xpath.sevalunknownfunction
msgctxt "laz2_xpath.sevalunknownfunction"
msgid "Unknown function: \"%s\"" msgid "Unknown function: \"%s\""
msgstr "Неизвестная функция: \"%s\"" msgstr "Неизвестная функция: \"%s\""
#: laz2_xpath.sevalunknownvariable #: laz2_xpath.sevalunknownvariable
msgctxt "laz2_xpath.sevalunknownvariable"
msgid "Unknown variable: \"%s\"" msgid "Unknown variable: \"%s\""
msgstr "Неизвестная переменная: \"%s\"" msgstr "Неизвестная переменная: \"%s\""
#: laz2_xpath.snodeset #: laz2_xpath.snodeset
msgctxt "laz2_xpath.snodeset"
msgid "node set" msgid "node set"
msgstr "набор элементов" msgstr "набор элементов"
#: laz2_xpath.snumber #: laz2_xpath.snumber
msgctxt "laz2_xpath.snumber"
msgid "number" msgid "number"
msgstr "числовой тип" msgstr "числовой тип"
#: laz2_xpath.sparserbadaxisname #: laz2_xpath.sparserbadaxisname
msgctxt "laz2_xpath.sparserbadaxisname"
msgid "Invalid axis name" msgid "Invalid axis name"
msgstr "Некорректное имя оси" msgstr "Некорректное имя оси"
#: laz2_xpath.sparserbadnodetype #: laz2_xpath.sparserbadnodetype
msgctxt "laz2_xpath.sparserbadnodetype"
msgid "Invalid node type" msgid "Invalid node type"
msgstr "Некорректный тип элемента" msgstr "Некорректный тип элемента"
#: laz2_xpath.sparserexpectedleftbracket #: laz2_xpath.sparserexpectedleftbracket
msgctxt "laz2_xpath.sparserexpectedleftbracket"
msgid "Expected \"(\"" msgid "Expected \"(\""
msgstr "Ожидается \"(\"" msgstr "Ожидается \"(\""
#: laz2_xpath.sparserexpectedrightbracket #: laz2_xpath.sparserexpectedrightbracket
msgctxt "laz2_xpath.sparserexpectedrightbracket"
msgid "Expected \")\"" msgid "Expected \")\""
msgstr "Ожидается \")\"" msgstr "Ожидается \")\""
#: laz2_xpath.sparserexpectedrightsquarebracket #: laz2_xpath.sparserexpectedrightsquarebracket
msgctxt "laz2_xpath.sparserexpectedrightsquarebracket"
msgid "Expected \"]\" after predicate" msgid "Expected \"]\" after predicate"
msgstr "После предиката ожидается \"]\"" msgstr "После предиката ожидается \"]\""
#: laz2_xpath.sparsergarbageafterexpression #: laz2_xpath.sparsergarbageafterexpression
msgctxt "laz2_xpath.sparsergarbageafterexpression"
msgid "Unrecognized input after expression" msgid "Unrecognized input after expression"
msgstr "Неопознанное содержимое после выражения" msgstr "Неопознанное содержимое после выражения"
#: laz2_xpath.sparserinvalidnodetest #: laz2_xpath.sparserinvalidnodetest
msgctxt "laz2_xpath.sparserinvalidnodetest"
msgid "Invalid node test (syntax error)" msgid "Invalid node test (syntax error)"
msgstr "Проверка элемента не удалась (синтаксическая ошибка)" msgstr "Проверка элемента не удалась (синтаксическая ошибка)"
#: laz2_xpath.sparserinvalidprimexpr #: laz2_xpath.sparserinvalidprimexpr
msgctxt "laz2_xpath.sparserinvalidprimexpr"
msgid "Invalid primary expression" msgid "Invalid primary expression"
msgstr "Некорректное первичное выражение" msgstr "Некорректное первичное выражение"
#: laz2_xpath.sscannerexpectedvarname #: laz2_xpath.sscannerexpectedvarname
msgctxt "laz2_xpath.sscannerexpectedvarname"
msgid "Expected variable name after \"$\"" msgid "Expected variable name after \"$\""
msgstr "После \"$\" ожидается имя переменной" msgstr "После \"$\" ожидается имя переменной"
#: laz2_xpath.sscannerinvalidchar #: laz2_xpath.sscannerinvalidchar
msgctxt "laz2_xpath.sscannerinvalidchar"
msgid "Invalid character" msgid "Invalid character"
msgstr "Некорректный символ" msgstr "Некорректный символ"
#: laz2_xpath.sscannermalformedqname #: laz2_xpath.sscannermalformedqname
msgctxt "laz2_xpath.sscannermalformedqname"
msgid "Expected \"*\" or local part after colon" msgid "Expected \"*\" or local part after colon"
msgstr "После двоеточия ожидается \"*\" либо локальная часть имени" msgstr "После двоеточия ожидается \"*\" либо локальная часть имени"
#: laz2_xpath.sscannerunclosedstring #: laz2_xpath.sscannerunclosedstring
msgctxt "laz2_xpath.sscannerunclosedstring"
msgid "String literal was not closed" msgid "String literal was not closed"
msgstr "Строковый литерал не имеет закрывающего символа" msgstr "Строковый литерал не имеет закрывающего символа"
#: laz2_xpath.sstring #: laz2_xpath.sstring
msgctxt "laz2_xpath.sstring"
msgid "string" msgid "string"
msgstr "строковый тип" msgstr "строковый тип"
#: laz2_xpath.svarnoconversion #: laz2_xpath.svarnoconversion
msgctxt "laz2_xpath.svarnoconversion"
msgid "Conversion from %s to %s not possible" msgid "Conversion from %s to %s not possible"
msgstr "Невозможно преобразовать %s в %s" msgstr "Невозможно преобразовать %s в %s"

View File

@ -21,40 +21,41 @@ unit laz2_xpath;
interface interface
uses Math, SysUtils, Classes, laz2_DOM, laz2_xmlutils; uses
Math, SysUtils, Classes, LazUtilsStrConsts,
laz2_DOM, laz2_xmlutils;
// ToDo: move to shared unit
resourcestring resourcestring
{ XPath variables type names } { XPath variables type names }
SNodeSet = 'node set'; lrsNodeSet = 'node set';
SBoolean = 'boolean'; lrsBoolean = 'boolean';
SNumber = 'number'; lrsNumber = 'number';
SString = 'string'; lrsString = 'string';
{ Variable errors } { Variable errors }
SVarNoConversion = 'Conversion from %s to %s not possible'; lrsVarNoConversion = 'Conversion from %s to %s not possible';
{ Scanner errors } { Scanner errors }
SScannerUnclosedString = 'String literal was not closed'; lrsScannerUnclosedString = 'String literal was not closed';
SScannerInvalidChar = 'Invalid character'; lrsScannerInvalidChar = 'Invalid character';
SScannerMalformedQName = 'Expected "*" or local part after colon'; lrsScannerMalformedQName = 'Expected "*" or local part after colon';
SScannerExpectedVarName = 'Expected variable name after "$"'; lrsScannerExpectedVarName = 'Expected variable name after "$"';
{ Parser errors } { Parser errors }
SParserExpectedLeftBracket = 'Expected "("'; lrsParserExpectedLeftBracket = 'Expected "("';
SParserExpectedRightBracket = 'Expected ")"'; lrsParserExpectedRightBracket = 'Expected ")"';
SParserBadAxisName = 'Invalid axis name'; lrsParserBadAxisName = 'Invalid axis name';
SParserBadNodeType = 'Invalid node type'; lrsParserBadNodeType = 'Invalid node type';
SParserExpectedRightSquareBracket = 'Expected "]" after predicate'; lrsParserExpectedRightSquareBracket = 'Expected "]" after predicate';
SParserInvalidPrimExpr = 'Invalid primary expression'; lrsParserInvalidPrimExpr = 'Invalid primary expression';
SParserGarbageAfterExpression = 'Unrecognized input after expression'; lrsParserGarbageAfterExpression = 'Unrecognized input after expression';
SParserInvalidNodeTest = 'Invalid node test (syntax error)'; lrsParserInvalidNodeTest = 'Invalid node test (syntax error)';
{ Evaluation errors } { Evaluation errors }
SEvalUnknownFunction = 'Unknown function: "%s"'; lrsEvalUnknownFunction = 'Unknown function: "%s"';
SEvalUnknownVariable = 'Unknown variable: "%s"'; lrsEvalUnknownVariable = 'Unknown variable: "%s"';
SEvalInvalidArgCount = 'Invalid number of function arguments'; lrsEvalInvalidArgCount = 'Invalid number of function arguments';
type type
TXPathContext = class; TXPathContext = class;
@ -787,7 +788,7 @@ function TXPathVariableNode.Evaluate(AContext: TXPathContext;
begin begin
Result := AEnvironment.VariablesByName[FName]; Result := AEnvironment.VariablesByName[FName];
if not Assigned(Result) then if not Assigned(Result) then
EvaluationError(SEvalUnknownVariable, [FName]); EvaluationError(lrsEvalUnknownVariable, [FName]);
end; end;
@ -816,7 +817,7 @@ var
begin begin
Fn := AEnvironment.FunctionsByName[FName]; Fn := AEnvironment.FunctionsByName[FName];
if not Assigned(Fn) then if not Assigned(Fn) then
EvaluationError(SEvalUnknownFunction, [FName]); EvaluationError(lrsEvalUnknownFunction, [FName]);
Args := TXPathVarList.Create; Args := TXPathVarList.Create;
try try
@ -1465,7 +1466,7 @@ end;
function TXPathVariable.AsNodeSet: TNodeSet; function TXPathVariable.AsNodeSet: TNodeSet;
begin begin
Error(SVarNoConversion, [TypeName, TXPathNodeSetVariable.TypeName]); Error(lrsVarNoConversion, [TypeName, TXPathNodeSetVariable.TypeName]);
Result := nil; Result := nil;
end; end;
@ -1489,7 +1490,7 @@ end;
class function TXPathNodeSetVariable.TypeName: String; class function TXPathNodeSetVariable.TypeName: String;
begin begin
Result := SNodeSet; Result := lrsNodeSet;
end; end;
function TXPathNodeSetVariable.AsNodeSet: TNodeSet; function TXPathNodeSetVariable.AsNodeSet: TNodeSet;
@ -1523,7 +1524,7 @@ end;
class function TXPathBooleanVariable.TypeName: String; class function TXPathBooleanVariable.TypeName: String;
begin begin
Result := SBoolean; Result := lrsBoolean;
end; end;
function TXPathBooleanVariable.AsBoolean: Boolean; function TXPathBooleanVariable.AsBoolean: Boolean;
@ -1556,7 +1557,7 @@ end;
class function TXPathNumberVariable.TypeName: String; class function TXPathNumberVariable.TypeName: String;
begin begin
Result := SNumber; Result := lrsNumber;
end; end;
function TXPathNumberVariable.AsBoolean: Boolean; function TXPathNumberVariable.AsBoolean: Boolean;
@ -1652,7 +1653,7 @@ end;
class function TXPathStringVariable.TypeName: String; class function TXPathStringVariable.TypeName: String;
begin begin
Result := SString; Result := lrsString;
end; end;
function TXPathStringVariable.AsBoolean: Boolean; function TXPathStringVariable.AsBoolean: Boolean;
@ -1784,7 +1785,7 @@ begin
while FCurData[0] <> Delim do while FCurData[0] <> Delim do
begin begin
if FCurData[0] = #0 then if FCurData[0] = #0 then
Error(SScannerUnclosedString); Error(lrsScannerUnclosedString);
Inc(FCurData); Inc(FCurData);
end; end;
FTokenLength := FCurData-FTokenStart; FTokenLength := FCurData-FTokenStart;
@ -1797,7 +1798,7 @@ begin
if ScanQName then if ScanQName then
Result := tkVariable Result := tkVariable
else else
Error(SScannerExpectedVarName); Error(lrsScannerExpectedVarName);
Exit; Exit;
end; end;
'(': '(':
@ -1876,12 +1877,12 @@ begin
Exit; Exit;
end end
else else
Error(SScannerMalformedQName); Error(lrsScannerMalformedQName);
end; end;
end; end;
if Result = tkInvalid then if Result = tkInvalid then
Error(SScannerInvalidChar); Error(lrsScannerInvalidChar);
// We have processed at least one character now; eat it: // We have processed at least one character now; eat it:
if Result > tkEndOfStream then if Result > tkEndOfStream then
Inc(FCurData); Inc(FCurData);
@ -1907,7 +1908,7 @@ begin
if I > High(Buffer) then if I > High(Buffer) then
AddNodes(Dest, Buffer, I); // will reset I to zero AddNodes(Dest, Buffer, I); // will reset I to zero
if not SkipToken(tkRightSquareBracket) then if not SkipToken(tkRightSquareBracket) then
Error(SParserExpectedRightSquareBracket); Error(lrsParserExpectedRightSquareBracket);
end; end;
AddNodes(Dest, Buffer, I); AddNodes(Dest, Buffer, I);
end; end;
@ -1938,7 +1939,7 @@ begin
if FTokenId in AxisNameKeywords then if FTokenId in AxisNameKeywords then
Axis := AxisNameMap[FTokenId] Axis := AxisNameMap[FTokenId]
else else
Error(SParserBadAxisName); Error(lrsParserBadAxisName);
NextToken; // skip identifier and the '::' NextToken; // skip identifier and the '::'
NextToken; NextToken;
end end
@ -1996,11 +1997,11 @@ begin
NextToken; NextToken;
end; end;
if CurToken <> tkRightBracket then if CurToken <> tkRightBracket then
Error(SParserExpectedRightBracket); Error(lrsParserExpectedRightBracket);
NextToken; NextToken;
end end
else else
Error(SParserBadNodeType); Error(lrsParserBadNodeType);
end end
else // [37] NameTest, third case else // [37] NameTest, third case
begin begin
@ -2019,7 +2020,7 @@ begin
end; end;
end end
else else
Error(SParserInvalidNodeTest); Error(lrsParserInvalidNodeTest);
Result := TStep.Create(Axis, nodeType); Result := TStep.Create(Axis, nodeType);
Result.NodeTestString := nodeName; Result.NodeTestString := nodeName;
@ -2036,7 +2037,7 @@ begin
NextToken; NextToken;
Result := ParseOrExpr; Result := ParseOrExpr;
if CurToken <> tkRightBracket then if CurToken <> tkRightBracket then
Error(SParserExpectedRightBracket); Error(lrsParserExpectedRightBracket);
end; end;
tkString: // [29] Literal tkString: // [29] Literal
Result := TXPathConstantNode.Create( Result := TXPathConstantNode.Create(
@ -2047,7 +2048,7 @@ begin
tkIdentifier: // [16] Function call tkIdentifier: // [16] Function call
Result := ParseFunctionCall; Result := ParseFunctionCall;
else else
Error(SParserInvalidPrimExpr); Error(lrsParserInvalidPrimExpr);
Result := nil; // satisfy compiler Result := nil; // satisfy compiler
end; end;
NextToken; NextToken;
@ -2063,7 +2064,7 @@ begin
Name := CurTokenString; Name := CurTokenString;
I := 0; I := 0;
if NextToken <> tkLeftBracket then if NextToken <> tkLeftBracket then
Error(SParserExpectedLeftBracket); Error(lrsParserExpectedLeftBracket);
NextToken; NextToken;
// Parse argument list // Parse argument list
Args:=nil; Args:=nil;
@ -2075,7 +2076,7 @@ begin
AddNodes(Args, Buffer, I); AddNodes(Args, Buffer, I);
until not SkipToken(tkComma); until not SkipToken(tkComma);
if CurToken <> tkRightBracket then if CurToken <> tkRightBracket then
Error(SParserExpectedRightBracket); Error(lrsParserExpectedRightBracket);
AddNodes(Args, Buffer, I); AddNodes(Args, Buffer, I);
Result := TXPathFunctionNode.Create(Name, Args); Result := TXPathFunctionNode.Create(Name, Args);
@ -2484,21 +2485,21 @@ end;
function TXPathEnvironment.xpLast(Context: TXPathContext; Args: TXPathVarList): TXPathVariable; function TXPathEnvironment.xpLast(Context: TXPathContext; Args: TXPathVarList): TXPathVariable;
begin begin
if Args.Count <> 0 then if Args.Count <> 0 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
Result := TXPathNumberVariable.Create(Context.ContextSize); Result := TXPathNumberVariable.Create(Context.ContextSize);
end; end;
function TXPathEnvironment.xpPosition(Context: TXPathContext; Args: TXPathVarList): TXPathVariable; function TXPathEnvironment.xpPosition(Context: TXPathContext; Args: TXPathVarList): TXPathVariable;
begin begin
if Args.Count <> 0 then if Args.Count <> 0 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
Result := TXPathNumberVariable.Create(Context.ContextPosition); Result := TXPathNumberVariable.Create(Context.ContextPosition);
end; end;
function TXPathEnvironment.xpCount(Context: TXPathContext; Args: TXPathVarList): TXPathVariable; function TXPathEnvironment.xpCount(Context: TXPathContext; Args: TXPathVarList): TXPathVariable;
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
Result := TXPathNumberVariable.Create(TXPathVariable(Args[0]).AsNodeSet.Count); Result := TXPathNumberVariable.Create(TXPathVariable(Args[0]).AsNodeSet.Count);
end; end;
@ -2537,7 +2538,7 @@ var
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
// TODO: probably have doc as member of Context // TODO: probably have doc as member of Context
if Context.ContextNode.NodeType = DOCUMENT_NODE then if Context.ContextNode.NodeType = DOCUMENT_NODE then
doc := TDOMDocument(Context.ContextNode) doc := TDOMDocument(Context.ContextNode)
@ -2564,7 +2565,7 @@ var
s: DOMString; s: DOMString;
begin begin
if Args.Count > 1 then if Args.Count > 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
n := nil; n := nil;
if Args.Count = 0 then if Args.Count = 0 then
n := Context.ContextNode n := Context.ContextNode
@ -2596,7 +2597,7 @@ var
s: DOMString; s: DOMString;
begin begin
if Args.Count > 1 then if Args.Count > 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
n := nil; n := nil;
if Args.Count = 0 then if Args.Count = 0 then
n := Context.ContextNode n := Context.ContextNode
@ -2620,7 +2621,7 @@ var
s: DOMString; s: DOMString;
begin begin
if Args.Count > 1 then if Args.Count > 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
n := nil; n := nil;
if Args.Count = 0 then if Args.Count = 0 then
n := Context.ContextNode n := Context.ContextNode
@ -2649,7 +2650,7 @@ var
s: DOMString; s: DOMString;
begin begin
if Args.Count > 1 then if Args.Count > 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
if Args.Count = 0 then if Args.Count = 0 then
s := NodeToText(Context.ContextNode) s := NodeToText(Context.ContextNode)
else else
@ -2663,7 +2664,7 @@ var
s: DOMString; s: DOMString;
begin begin
if Args.Count < 2 then if Args.Count < 2 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
SetLength(s, 0); SetLength(s, 0);
for i := 0 to Args.Count - 1 do for i := 0 to Args.Count - 1 do
s := s + TXPathVariable(Args[i]).AsText; s := s + TXPathVariable(Args[i]).AsText;
@ -2676,7 +2677,7 @@ var
res: Boolean; res: Boolean;
begin begin
if Args.Count <> 2 then if Args.Count <> 2 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
s1 := TXPathVariable(Args[0]).AsText; s1 := TXPathVariable(Args[0]).AsText;
s2 := TXPathVariable(Args[1]).AsText; s2 := TXPathVariable(Args[1]).AsText;
if s2 = '' then if s2 = '' then
@ -2692,7 +2693,7 @@ var
res: Boolean; res: Boolean;
begin begin
if Args.Count <> 2 then if Args.Count <> 2 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
s1 := TXPathVariable(Args[0]).AsText; s1 := TXPathVariable(Args[0]).AsText;
s2 := TXPathVariable(Args[1]).AsText; s2 := TXPathVariable(Args[1]).AsText;
if s2 = '' then if s2 = '' then
@ -2707,7 +2708,7 @@ var
s, substr: DOMString; s, substr: DOMString;
begin begin
if Args.Count <> 2 then if Args.Count <> 2 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
s := TXPathVariable(Args[0]).AsText; s := TXPathVariable(Args[0]).AsText;
substr := TXPathVariable(Args[1]).AsText; substr := TXPathVariable(Args[1]).AsText;
Result := TXPathStringVariable.Create(Copy(s, 1, Pos(substr, s)-1)); Result := TXPathStringVariable.Create(Copy(s, 1, Pos(substr, s)-1));
@ -2719,7 +2720,7 @@ var
i: Integer; i: Integer;
begin begin
if Args.Count <> 2 then if Args.Count <> 2 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
s := TXPathVariable(Args[0]).AsText; s := TXPathVariable(Args[0]).AsText;
substr := TXPathVariable(Args[1]).AsText; substr := TXPathVariable(Args[1]).AsText;
i := Pos(substr, s); i := Pos(substr, s);
@ -2737,7 +2738,7 @@ var
empty: Boolean; empty: Boolean;
begin begin
if (Args.Count < 2) or (Args.Count > 3) then if (Args.Count < 2) or (Args.Count > 3) then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
s := TXPathVariable(Args[0]).AsText; s := TXPathVariable(Args[0]).AsText;
e1 := TXPathVariable(Args[1]).AsNumber; e1 := TXPathVariable(Args[1]).AsNumber;
n1 := 1; // satisfy compiler n1 := 1; // satisfy compiler
@ -2766,7 +2767,7 @@ var
s: DOMString; s: DOMString;
begin begin
if Args.Count > 1 then if Args.Count > 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
if Args.Count = 0 then if Args.Count = 0 then
s := NodeToText(Context.ContextNode) s := NodeToText(Context.ContextNode)
else else
@ -2781,7 +2782,7 @@ var
i: Integer; i: Integer;
begin begin
if Args.Count > 1 then if Args.Count > 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
if Args.Count = 0 then if Args.Count = 0 then
s := NodeToText(Context.ContextNode) s := NodeToText(Context.ContextNode)
else else
@ -2803,7 +2804,7 @@ var
S: DOMString; S: DOMString;
begin begin
if Args.Count <> 3 then if Args.Count <> 3 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
S := TXPathVariable(Args[0]).AsText; S := TXPathVariable(Args[0]).AsText;
TranslateUTF8Chars(S, TXPathVariable(Args[1]).AsText, TXPathVariable(Args[2]).AsText); TranslateUTF8Chars(S, TXPathVariable(Args[1]).AsText, TXPathVariable(Args[2]).AsText);
Result := TXPathStringVariable.Create(S); Result := TXPathStringVariable.Create(S);
@ -2812,28 +2813,28 @@ end;
function TXPathEnvironment.xpBoolean(Context: TXPathContext; Args: TXPathVarList): TXPathVariable; function TXPathEnvironment.xpBoolean(Context: TXPathContext; Args: TXPathVarList): TXPathVariable;
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
Result := TXPathBooleanVariable.Create(TXPathVariable(Args[0]).AsBoolean); Result := TXPathBooleanVariable.Create(TXPathVariable(Args[0]).AsBoolean);
end; end;
function TXPathEnvironment.xpNot(Context: TXPathContext; Args: TXPathVarList): TXPathVariable; function TXPathEnvironment.xpNot(Context: TXPathContext; Args: TXPathVarList): TXPathVariable;
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
Result := TXPathBooleanVariable.Create(not TXPathVariable(Args[0]).AsBoolean); Result := TXPathBooleanVariable.Create(not TXPathVariable(Args[0]).AsBoolean);
end; end;
function TXPathEnvironment.xpTrue(Context: TXPathContext; Args: TXPathVarList): TXPathVariable; function TXPathEnvironment.xpTrue(Context: TXPathContext; Args: TXPathVarList): TXPathVariable;
begin begin
if Args.Count <> 0 then if Args.Count <> 0 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
Result := TXPathBooleanVariable.Create(True); Result := TXPathBooleanVariable.Create(True);
end; end;
function TXPathEnvironment.xpFalse(Context: TXPathContext; Args: TXPathVarList): TXPathVariable; function TXPathEnvironment.xpFalse(Context: TXPathContext; Args: TXPathVarList): TXPathVariable;
begin begin
if Args.Count <> 0 then if Args.Count <> 0 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
Result := TXPathBooleanVariable.Create(False); Result := TXPathBooleanVariable.Create(False);
end; end;
@ -2844,7 +2845,7 @@ var
res: Boolean; res: Boolean;
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
TheArg := TXPathVariable(Args[0]).AsText; TheArg := TXPathVariable(Args[0]).AsText;
NodeLang := GetNodeLanguage(Context.ContextNode); NodeLang := GetNodeLanguage(Context.ContextNode);
@ -2859,7 +2860,7 @@ end;
function TXPathEnvironment.xpNumber(Context: TXPathContext; Args: TXPathVarList): TXPathVariable; function TXPathEnvironment.xpNumber(Context: TXPathContext; Args: TXPathVarList): TXPathVariable;
begin begin
if Args.Count > 1 then if Args.Count > 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
if Args.Count = 0 then if Args.Count = 0 then
Result := TXPathNumberVariable.Create(StrToNumber(NodeToText(Context.ContextNode))) Result := TXPathNumberVariable.Create(StrToNumber(NodeToText(Context.ContextNode)))
else else
@ -2873,7 +2874,7 @@ var
sum: Extended; sum: Extended;
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
ns := TXPathVariable(Args[0]).AsNodeSet; ns := TXPathVariable(Args[0]).AsNodeSet;
sum := 0.0; sum := 0.0;
for i := 0 to ns.Count-1 do for i := 0 to ns.Count-1 do
@ -2886,7 +2887,7 @@ var
n: Extended; n: Extended;
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
n := TXPathVariable(Args[0]).AsNumber; n := TXPathVariable(Args[0]).AsNumber;
if not IsNan(n) then if not IsNan(n) then
n := floor(n); n := floor(n);
@ -2898,7 +2899,7 @@ var
n: Extended; n: Extended;
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
n := TXPathVariable(Args[0]).AsNumber; n := TXPathVariable(Args[0]).AsNumber;
if not IsNan(n) then if not IsNan(n) then
n := ceil(n); n := ceil(n);
@ -2910,7 +2911,7 @@ var
num: Extended; num: Extended;
begin begin
if Args.Count <> 1 then if Args.Count <> 1 then
EvaluationError(SEvalInvalidArgCount); EvaluationError(lrsEvalInvalidArgCount);
num := TXPathVariable(Args[0]).AsNumber; num := TXPathVariable(Args[0]).AsNumber;
if not (IsNan(num) or IsInfinite(num)) then if not (IsNan(num) or IsInfinite(num)) then
num := floor(0.5 + num); num := floor(0.5 + num);
@ -2928,7 +2929,7 @@ begin
AScanner.FResolver := AResolver; AScanner.FResolver := AResolver;
FRootNode := AScanner.ParseOrExpr; FRootNode := AScanner.ParseOrExpr;
if CompleteExpression and (AScanner.CurToken <> tkEndOfStream) then if CompleteExpression and (AScanner.CurToken <> tkEndOfStream) then
EvaluationError(SParserGarbageAfterExpression); EvaluationError(lrsParserGarbageAfterExpression);
end; end;
function TXPathExpression.Evaluate(AContextNode: TDOMNode): TXPathVariable; function TXPathExpression.Evaluate(AContextNode: TDOMNode): TXPathVariable;

View File

@ -1,4 +1,3 @@
{ $Id: lclstrconsts.pas 32042 2011-08-24 21:03:41Z maxim $ }
{ {
/*************************************************************************** /***************************************************************************
LazUtilsStrConsts.pas LazUtilsStrConsts.pas