diff options
| -rw-r--r-- | Mammoth/Couscous/java/util/Queue.cs | 1 | ||||
| -rw-r--r-- | Mammoth/Couscous/mammoth/internal/util/Queues.cs | 12 | ||||
| -rw-r--r-- | Mammoth/generated.cs | 8 | ||||
| m--------- | java-mammoth | 0 |
4 files changed, 16 insertions, 5 deletions
diff --git a/Mammoth/Couscous/java/util/Queue.cs b/Mammoth/Couscous/java/util/Queue.cs index 6cb462f..8b757db 100644 --- a/Mammoth/Couscous/java/util/Queue.cs +++ b/Mammoth/Couscous/java/util/Queue.cs @@ -3,6 +3,7 @@ using Mammoth.Couscous.java.lang; namespace Mammoth.Couscous.java.util { internal interface Queue<T> : Iterable<T> { void add(T value); + bool isEmpty(); T remove(); } } diff --git a/Mammoth/Couscous/mammoth/internal/util/Queues.cs b/Mammoth/Couscous/mammoth/internal/util/Queues.cs index 9bf099c..325b29a 100644 --- a/Mammoth/Couscous/mammoth/internal/util/Queues.cs +++ b/Mammoth/Couscous/mammoth/internal/util/Queues.cs @@ -8,18 +8,22 @@ namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util return new Stack<T>(); } } - + internal class Stack<T> : Queue<T> { private readonly System.Collections.Generic.IList<T> _stack = new System.Collections.Generic.List<T>(); - + public Iterator<T> iterator() { return ToJava.EnumeratorToIterator(_stack.GetEnumerator()); } - + public void add(T value) { _stack.Add(value); } - + + public bool isEmpty() { + return _stack.Count == 0; + } + public T remove() { var index = _stack.Count - 1; var value = _stack[index]; diff --git a/Mammoth/generated.cs b/Mammoth/generated.cs index 0155ded..54fbfc1 100644 --- a/Mammoth/generated.cs +++ b/Mammoth/generated.cs @@ -4163,6 +4163,9 @@ namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.docx { (this._complexFieldStack).add(Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.StatefulBodyXmlReader__ComplexField_static.begin(element)); (this._currentInstrText).setLength(0); } else if (type.Equals("end")) { + if ((this._complexFieldStack).isEmpty()) { + return Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.ReadResult.emptyWithWarning("Ignoring complex field end character without corresponding start character"); + } Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.StatefulBodyXmlReader__ComplexField complexField = (this._complexFieldStack).remove(); if (complexField is Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.StatefulBodyXmlReader__BeginComplexField) { complexField = this.parseCurrentInstrText(complexField); @@ -4171,6 +4174,9 @@ namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.docx { return Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.ReadResult.success(new Mammoth.Couscous.org.zwobble.mammoth.@internal.documents.Checkbox(((Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.StatefulBodyXmlReader__CheckboxComplexField) complexField)._checked)); } } else if (type.Equals("separate")) { + if ((this._complexFieldStack).isEmpty()) { + return Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.ReadResult.emptyWithWarning("Ignoring complex field separator character without corresponding start character"); + } Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.StatefulBodyXmlReader__ComplexField complexFieldSeparate = (this._complexFieldStack).remove(); Mammoth.Couscous.org.zwobble.mammoth.@internal.docx.StatefulBodyXmlReader__ComplexField complexField = this.parseCurrentInstrText(complexFieldSeparate); (this._complexFieldStack).add(complexField); @@ -6854,7 +6860,7 @@ namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing { return new Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenIterator<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.StyleMappingTokeniser.tokeniseToList(line), new Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.Token<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(line.Length, Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType._EOF, "")); } public static Mammoth.Couscous.java.util.List<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.Token<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>> tokeniseToList(string line) { - string stringPrefix = "'(?:(?:\\\\.|[^'])*)"; + string stringPrefix = "'(?:(?:\\\\(?:.|$)|[^'\\\\])*)"; string identifierCharacter = "(?:[a-zA-Z\\-_]|\\\\.)"; Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType> tokeniser = new Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType._UNKNOWN, Mammoth.Couscous.org.zwobble.mammoth.@internal.util.Lists.list<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser__TokenRule<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>>(new Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser__TokenRule<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>[] {Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser.rule<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType._IDENTIFIER, ((identifierCharacter + "(?:") + identifierCharacter) + "|[0-9])*"), Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser.rule<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType._SYMBOL, ":|>|=>|\\^=|=|\\(|\\)|\\[|\\]|\\||!|\\."), Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser.rule<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType._WHITESPACE, "\\s+"), Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser.rule<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType._STRING, stringPrefix + "'"), Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser.rule<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType._UNTERMINATED_STRING, stringPrefix), Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.RegexTokeniser.rule<Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType>(Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing.TokenType._INTEGER, "[0-9]+")})); return tokeniser.tokenise(line); diff --git a/java-mammoth b/java-mammoth -Subproject 972b8e2407f11d00927e81cd54efe6f1fe5c234 +Subproject 0ee7fbb98f8f119d6086bc08bfbe959643e9dd4 |
