diff options
| author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-04-12 18:48:56 +0200 | 
|---|---|---|
| committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:24:16 +0200 | 
| commit | 95ce14b9ea89178ddb8788887db8b4b32ced5d79 (patch) | |
| tree | 1fb609fbe567370646a6cbf022ce678aa5a192d7 | |
| parent | 667d9c4a082552fb64c5ffe7b0bd6212c8a8b1b3 (diff) | |
If in the implicit default field of a non-greedy short form, only read data until whitespace characters are reached. Improve tests accordingly.
5 files changed, 13 insertions, 5 deletions
| diff --git a/src/core/parser/stack/Stack.cpp b/src/core/parser/stack/Stack.cpp index cc1eb23..75a4b49 100644 --- a/src/core/parser/stack/Stack.cpp +++ b/src/core/parser/stack/Stack.cpp @@ -1528,8 +1528,11 @@ bool StackImpl::readToken(Token &token)  {  	if (dataReader != nullptr) {  		dataReader->resetPeek(); -		return dataReader->peek(token, currentTokens(), -		                        currentWhitespaceMode()); +		const HandlerInfo &info = currentInfo(); +		const bool endAtWhitespace = +		    (!info.greedy && info.inImplicitDefaultField); +		return dataReader->peek(token, currentTokens(), currentWhitespaceMode(), +		                        endAtWhitespace);  	}  	return false;  } diff --git a/testdata/integration/user_defined_syntax/math_limits.in.osml b/testdata/integration/user_defined_syntax/math_limits.in.osml index 3fdf77b..d8aa3d4 100644 --- a/testdata/integration/user_defined_syntax/math_limits.in.osml +++ b/testdata/integration/user_defined_syntax/math_limits.in.osml @@ -1,5 +1,5 @@  \document  \import[ontology]{./ontologies/math}  \begin{math} -	\sum_{i=3}^{5} i_{M}^{2} +	\sum_{i=3}^5 i_{M}^{2}  \end{math} diff --git a/testdata/integration/user_defined_syntax/non_greedy_shortform.in.osml b/testdata/integration/user_defined_syntax/non_greedy_shortform.in.osml index 68866c6..0d700c2 100644 --- a/testdata/integration/user_defined_syntax/non_greedy_shortform.in.osml +++ b/testdata/integration/user_defined_syntax/non_greedy_shortform.in.osml @@ -1,2 +1,2 @@  \import[ontology]{./ontologies/non_greedy_shortform} -\begin{test}?a ?b?c ??d + ?+{?} \end{test} +\begin{test}?a ?b?c ??d + ?+{?} ??e f\end{test} diff --git a/testdata/integration/user_defined_syntax/non_greedy_shortform.out.osxml b/testdata/integration/user_defined_syntax/non_greedy_shortform.out.osxml index c2431eb..3ca0913 100644 --- a/testdata/integration/user_defined_syntax/non_greedy_shortform.out.osxml +++ b/testdata/integration/user_defined_syntax/non_greedy_shortform.out.osxml @@ -11,5 +11,8 @@  		<test:b>  			<test:a/>  		</test:b> +		<test:a/> +		<test:a>e</test:a> +		<test:text>f</test:text>  	</test:test>  </document> diff --git a/testdata/integration/user_defined_syntax/ontologies/non_greedy_shortform.osml b/testdata/integration/user_defined_syntax/ontologies/non_greedy_shortform.osml index 7a370ac..6179237 100644 --- a/testdata/integration/user_defined_syntax/ontologies/non_greedy_shortform.osml +++ b/testdata/integration/user_defined_syntax/ontologies/non_greedy_shortform.osml @@ -3,6 +3,7 @@  		\field  			\childRef[a]  			\childRef[b] +			\childRef[text]  	\struct#a  		\syntax  			\short[false]{?} @@ -12,4 +13,5 @@  			\short[false]{+}  		\field  			\childRef[a] - +	\struct#text[transparent=true] +		\primitive[type=string] | 
