protected TokenList . Token parseBlockNoParentheses ( TokenList tokens , Sequence sequence , boolean insideMatrixConstructor ) { // search for matrix bracket operations if ( ! insideMatrixConstructor ) { parseBracketCreateMatrix ( tokens , sequence ) ; } // First create sequences from anything involving a colon parseSequencesWithColons ( tokens , sequence ) ; // process operators depending on their priority parseNegOp ( tokens , sequence ) ; parseOperationsL ( tokens , sequence ) ; parseOperationsLR ( new Symbol [ ] { Symbol . POWER , Symbol . ELEMENT_POWER } , tokens , sequence ) ; parseOperationsLR ( new Symbol [ ] { Symbol . TIMES , Symbol . RDIVIDE , Symbol . LDIVIDE , Symbol . ELEMENT_TIMES , Symbol . ELEMENT_DIVIDE } , tokens , sequence ) ; parseOperationsLR ( new Symbol [ ] { Symbol . PLUS , Symbol . MINUS } , tokens , sequence ) ; // Commas are used in integer sequences. Can be used to force to compiler to treat - as negative not // minus. They can now be removed since they have served their purpose stripCommas ( tokens ) ; // now construct rest of the lists and combine them together parseIntegerLists ( tokens ) ; parseCombineIntegerLists ( tokens ) ; if ( ! insideMatrixConstructor ) { if ( tokens . size ( ) > 1 ) { System . err . println ( "Remaining tokens: " + tokens . size ) ; TokenList . Token t = tokens . first ; while ( t != null ) { System . err . println ( " " + t ) ; t = t . next ; } throw new RuntimeException ( "BUG in parser. There should only be a single token left" ) ; } return tokens . first ; } else { return null ; } }
Parses a code block with no parentheses and no commas . After it is done there should be a single token left which is returned .