summaryrefslogtreecommitdiff
path: root/connectivity/source/commontools/RowFunctionParser.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/commontools/RowFunctionParser.cxx')
-rw-r--r--connectivity/source/commontools/RowFunctionParser.cxx108
1 files changed, 54 insertions, 54 deletions
diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx
index 40e119419f2d..590cfb648934 100644
--- a/connectivity/source/commontools/RowFunctionParser.cxx
+++ b/connectivity/source/commontools/RowFunctionParser.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
-// Makes parser a static resource,
+// Makes parser a static resource,
// we're synchronized externally.
// But watch out, the parser might have
// state not visible to this code!
@@ -97,9 +97,9 @@ public:
*/
class BinaryFunctionExpression : public ExpressionNode
{
- const ExpressionFunct meFunct;
- ExpressionNodeSharedPtr mpFirstArg;
- ExpressionNodeSharedPtr mpSecondArg;
+ const ExpressionFunct meFunct;
+ ExpressionNodeSharedPtr mpFirstArg;
+ ExpressionNodeSharedPtr mpSecondArg;
public:
@@ -113,7 +113,7 @@ public:
{
ORowSetValueDecoratorRef aRet;
switch(meFunct)
- {
+ {
case ENUM_FUNC_EQUATION:
aRet = new ORowSetValueDecorator(sal_Bool(mpFirstArg->evaluate(_aRow )->getValue() == mpSecondArg->evaluate(_aRow )->getValue()) );
break;
@@ -131,7 +131,7 @@ public:
virtual void fill(const ODatabaseMetaDataResultSet::ORow& _aRow ) const
{
switch(meFunct)
- {
+ {
case ENUM_FUNC_EQUATION:
(*mpFirstArg->evaluate(_aRow )) = mpSecondArg->evaluate(_aRow )->getValue();
break;
@@ -168,7 +168,7 @@ struct ParserContext
// arguments from. If all arguments to an operator are constant,
// the operator pushes a precalculated result on the stack, and
// a composite ExpressionNode otherwise.
- OperandStack maOperandStack;
+ OperandStack maOperandStack;
};
typedef ::boost::shared_ptr< ParserContext > ParserContextSharedPtr;
@@ -178,7 +178,7 @@ typedef ::boost::shared_ptr< ParserContext > ParserContextSharedPtr;
class ConstantFunctor
{
- ParserContextSharedPtr mpContext;
+ ParserContextSharedPtr mpContext;
public:
@@ -197,7 +197,7 @@ public:
*/
class IntConstantFunctor
{
- ParserContextSharedPtr mpContext;
+ ParserContextSharedPtr mpContext;
public:
IntConstantFunctor( const ParserContextSharedPtr& rContext ) :
@@ -220,12 +220,12 @@ public:
@tpl Generator
Generator functor, to generate an ExpressionNode of
appropriate type
-
+
*/
class BinaryFunctionFunctor
{
- const ExpressionFunct meFunct;
- ParserContextSharedPtr mpContext;
+ const ExpressionFunct meFunct;
+ ParserContextSharedPtr mpContext;
public:
@@ -259,8 +259,8 @@ public:
*/
class UnaryFunctionExpression : public ExpressionNode
{
- const ExpressionFunct meFunct;
- ExpressionNodeSharedPtr mpArg;
+ const ExpressionFunct meFunct;
+ ExpressionNodeSharedPtr mpArg;
public:
UnaryFunctionExpression( const ExpressionFunct eFunct, const ExpressionNodeSharedPtr& rArg ) :
@@ -288,11 +288,11 @@ public:
class UnaryFunctionFunctor
{
- const ExpressionFunct meFunct;
- ParserContextSharedPtr mpContext;
+ const ExpressionFunct meFunct;
+ ParserContextSharedPtr mpContext;
public :
-
+
UnaryFunctionFunctor( const ExpressionFunct eFunct, const ParserContextSharedPtr& rContext ) :
meFunct( eFunct ),
mpContext( rContext )
@@ -300,7 +300,7 @@ public :
}
void operator()( StringIteratorT, StringIteratorT ) const
{
-
+
ParserContext::OperandStack& rNodeStack( mpContext->maOperandStack );
if( rNodeStack.size() < 1 )
@@ -318,20 +318,20 @@ public :
less literally written down below, only slightly
obfuscated by the parser actions):
- basic_expression =
- number |
- '(' additive_expression ')'
-
- unary_expression =
+ basic_expression =
+ number |
+ '(' additive_expression ')'
+
+ unary_expression =
basic_expression
-
- multiplicative_expression =
- unary_expression ( ( '*' unary_expression )* |
+
+ multiplicative_expression =
+ unary_expression ( ( '*' unary_expression )* |
( '/' unary_expression )* )
-
- additive_expression =
- multiplicative_expression ( ( '+' multiplicative_expression )* |
- ( '-' multiplicative_expression )* )
+
+ additive_expression =
+ multiplicative_expression ( ( '+' multiplicative_expression )* |
+ ( '-' multiplicative_expression )* )
*/
class ExpressionGrammar : public ::boost::spirit::grammar< ExpressionGrammar >
@@ -364,29 +364,29 @@ public:
using ::boost::spirit::as_lower_d;
using ::boost::spirit::strlit;
using ::boost::spirit::inhibit_case;
-
+
typedef inhibit_case<strlit<> > token_t;
token_t COLUMN = as_lower_d[ "column" ];
token_t OR_ = as_lower_d[ "or" ];
token_t AND_ = as_lower_d[ "and" ];
- integer =
+ integer =
int_p
[IntConstantFunctor(self.getContext())];
- argument =
+ argument =
integer
| lexeme_d[ +( range_p('a','z') | range_p('A','Z') | range_p('0','9') ) ]
[ ConstantFunctor(self.getContext()) ]
;
- unaryFunction =
+ unaryFunction =
(COLUMN >> '(' >> integer >> ')' )
[ UnaryFunctionFunctor( UNARY_FUNC_COLUMN, self.getContext()) ]
;
- assignment =
+ assignment =
unaryFunction >> ch_p('=') >> argument
[ BinaryFunctionFunctor( ENUM_FUNC_EQUATION, self.getContext()) ]
;
@@ -397,12 +397,12 @@ public:
| ( assignment >> AND_ >> assignment ) [ BinaryFunctionFunctor( ENUM_FUNC_AND, self.getContext()) ]
;
- orExpression =
+ orExpression =
andExpression
| ( orExpression >> OR_ >> andExpression ) [ BinaryFunctionFunctor( ENUM_FUNC_OR, self.getContext()) ]
;
- basicExpression =
+ basicExpression =
orExpression
;
@@ -419,16 +419,16 @@ public:
{
return basicExpression;
}
-
+
private:
- // the constituents of the Spirit arithmetic expression grammar.
+ // the constituents of the Spirit arithmetic expression grammar.
// For the sake of readability, without 'ma' prefix.
- ::boost::spirit::rule< ScannerT > basicExpression;
- ::boost::spirit::rule< ScannerT > unaryFunction;
- ::boost::spirit::rule< ScannerT > assignment;
- ::boost::spirit::rule< ScannerT > integer,argument;
- ::boost::spirit::rule< ScannerT > orExpression,andExpression;
- };
+ ::boost::spirit::rule< ScannerT > basicExpression;
+ ::boost::spirit::rule< ScannerT > unaryFunction;
+ ::boost::spirit::rule< ScannerT > assignment;
+ ::boost::spirit::rule< ScannerT > integer,argument;
+ ::boost::spirit::rule< ScannerT > orExpression,andExpression;
+ };
const ParserContextSharedPtr& getContext() const
{
@@ -436,15 +436,15 @@ public:
}
private:
- ParserContextSharedPtr mpParserContext; // might get modified during parsing
+ ParserContextSharedPtr mpParserContext; // might get modified during parsing
};
-
+
#ifdef BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE
const ParserContextSharedPtr& getParserContext()
{
static ParserContextSharedPtr lcl_parserContext( new ParserContext() );
- // clear node stack (since we reuse the static object, that's
+ // clear node stack (since we reuse the static object, that's
// the whole point here)
while( !lcl_parserContext->maOperandStack.empty() )
lcl_parserContext->maOperandStack.pop();
@@ -456,10 +456,10 @@ const ParserContextSharedPtr& getParserContext()
ExpressionNodeSharedPtr FunctionParser::parseFunction( const ::rtl::OUString& _sFunction)
{
- // TODO(Q1): Check if a combination of the RTL_UNICODETOTEXT_FLAGS_*
- // gives better conversion robustness here (we might want to map space
+ // TODO(Q1): Check if a combination of the RTL_UNICODETOTEXT_FLAGS_*
+ // gives better conversion robustness here (we might want to map space
// etc. to ASCII space here)
- const ::rtl::OString& rAsciiFunction(
+ const ::rtl::OString& rAsciiFunction(
rtl::OUStringToOString( _sFunction, RTL_TEXTENCODING_ASCII_US ) );
StringIteratorT aStart( rAsciiFunction.getStr() );
@@ -477,7 +477,7 @@ ExpressionNodeSharedPtr FunctionParser::parseFunction( const ::rtl::OUString& _s
ExpressionGrammar aExpressionGrammer( pContext );
- const ::boost::spirit::parse_info<StringIteratorT> aParseInfo(
+ const ::boost::spirit::parse_info<StringIteratorT> aParseInfo(
::boost::spirit::parse( aStart,
aEnd,
aExpressionGrammer,
@@ -489,7 +489,7 @@ ExpressionNodeSharedPtr FunctionParser::parseFunction( const ::rtl::OUString& _s
if( !aParseInfo.full )
throw ParseError( "RowFunctionParser::parseFunction(): string not fully parseable" );
- // parser's state stack now must contain exactly _one_ ExpressionNode,
+ // parser's state stack now must contain exactly _one_ ExpressionNode,
// which represents our formula.
if( pContext->maOperandStack.size() != 1 )
throw ParseError( "RowFunctionParser::parseFunction(): incomplete or empty expression" );