This method parses the {@link Condition#comparatorArgument comparator argument}.

@param scanner is the {@link CharSequenceScanner}.
@return the parsed comparator argument.
551527
private Object parseComparatorArgument(CharSequenceScanner scanner) {

    int index = scanner.getCurrentIndex();
    Object comparatorArgument;
    char c = scanner.forcePeek();
    if ((c == '"') || (c == '\'')) {
      scanner.next();
      comparatorArgument = scanner.readUntil(c, false, c);
    } else {
      String argument = scanner.readWhile(FILTER_COMPARATOR_ARGUMENT);
      if (argument.length() == 0) {
        throw new IllegalArgumentException(scanner.substring(index, scanner.getCurrentIndex()));
      }
      if ("null".equals(argument)) {
        comparatorArgument = null;
      } else if (argument.matches(Iso8601UtilLimited.PATTERN_STRING_ALL)) {
        comparatorArgument = this.nlsDependencies.getIso8601Util().parseDate(argument);
      } else if (Boolean.TRUE.toString().equals(argument)) {
        comparatorArgument = Boolean.TRUE;
      } else if (Boolean.FALSE.toString().equals(argument)) {
        comparatorArgument = Boolean.FALSE;
      } else {
        // double vs. date?
        comparatorArgument = Double.valueOf(argument);
      }
    }
    return comparatorArgument;
  }
387259
final public Selector Predicate() throws ParseException {
                         Selector ans;
    if (jj_2_1(2147483647)) {
      ans = ComparisonPredicate();
    } else if (jj_2_2(2147483647)) {
      ans = NullPredicate();
    } else if (jj_2_3(2147483647)) {
      ans = BetweenPredicate();
    } else if (jj_2_4(2147483647)) {
      ans = LikePredicate();
    } else if (jj_2_5(2147483647)) {
      ans = JMSSetPredicate();
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 7:
      case 8:
      case 11:
      case TRUE:
      case FALSE:
      case IDENTIFIER:
      case QUOTED_IDENTIFIER:
      case INTEGER_LITERAL:
      case FLOATING_POINT_LITERAL:
      case STRING_LITERAL:
        ans = Expression();
        break;
      default:
        jj_la1[3] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    {if (true) return ans;}
    throw new Error("Missing return statement in function");
  }
1000197
private Choice parseChoice(CharSequenceScanner scanner) {

    Filter<Object> condition = parseCondition(scanner);
    List<Segment> segments = new ArrayList<>();
    while (scanner.hasNext()) {
      int index = scanner.getCurrentIndex();
      char c = scanner.peek();
      String literal = null;
      if ((c == '"') || (c == '\'')) {
        scanner.next();
        literal = scanner.readUntil(c, false, c);
        if (literal == null) {
          throw new IllegalArgumentException(scanner.substring(index, scanner.getCurrentIndex()));
        }
        c = scanner.peek();
      }
      NlsArgument argument = null;
      if (c == NlsArgumentParser.START_EXPRESSION) {
        scanner.next();
        argument = this.nlsDependencies.getArgumentParser().parse(scanner);
      }
      if ((argument != null) || (literal != null)) {
        segments.add(new Segment(literal, argument));
      } else {
        break;
      }
    }
    return new Choice(condition, segments);
  }
1087913
private void parse(String[] s) {
    commandLineArgs = new Entry[0];
    for( int i = 0; i < s.length; ) {
      String next = (i+1<s.length)? s[i+1]: null;
      i += addArgument(s[i],next);
    }
  }
1182569
protected int[] parseTime(CharSequenceScanner scanner) {

    int hour = read2Digits(scanner);
    boolean colon = scanner.expect(':');
    int minute = read2Digits(scanner);
    int second = 0;
    if (minute == -1) {
      if (!colon) {
        minute = 0;
      }
    } else {
      colon = scanner.expect(':');
      second = read2Digits(scanner);
      if ((second == -1) && (!colon)) {
        second = 0;
      }
      if (((hour < 0) || (hour > 23)) || ((minute < 0) || (minute > 59)) || ((second < 0) || (second > 59))) {
        throw new IllegalDateFormatException(scanner.getOriginalString());
      }
    }
    return new int[] { hour, minute, second };
  }
797505
private ParsedResultAccumulator getBestCostPlanForEphemeralScans(List<StmtEphemeralTableScan> scans) {
        int nextPlanId = m_planSelector.m_planId;
        boolean orderIsDeterministic = true;
        boolean hasSignificantOffsetOrLimit = false;
        String contentNonDeterminismMessage = null;
        for (StmtEphemeralTableScan scan : scans) {
            if (scan instanceof StmtSubqueryScan) {
                nextPlanId = planForParsedSubquery((StmtSubqueryScan)scan, nextPlanId);
                // If we can't plan this, then give up.
                if (((StmtSubqueryScan) scan).getBestCostPlan() == null) {
                    return null;
                }
            }
            else if (scan instanceof StmtCommonTableScan) {
                nextPlanId = planForCommonTableQuery((StmtCommonTableScan)scan, nextPlanId);
                if (((StmtCommonTableScan) scan).getBestCostBasePlan() == null) {
                    return null;
                }
            }
            else {
                throw new PlanningErrorException("Unknown scan plan type.");
            }
            orderIsDeterministic = scan.isOrderDeterministic(orderIsDeterministic);
            contentNonDeterminismMessage = scan.contentNonDeterminismMessage(contentNonDeterminismMessage);
            hasSignificantOffsetOrLimit = scan.hasSignificantOffsetOrLimit(hasSignificantOffsetOrLimit);
        }
        // need to reset plan id for the entire SQL
        m_planSelector.m_planId = nextPlanId;

        return new ParsedResultAccumulator(orderIsDeterministic,
                                           hasSignificantOffsetOrLimit,
                                           contentNonDeterminismMessage);
    }
466725
private int scan(String string, int i, CharBuffer cb, boolean dash)
    throws Exception
  {
    char ch;

    cb.length(0);

    int strlen = string.length();
    for (; i < strlen; i++) {
      if (! Character.isWhitespace(ch = string.charAt(i)) &&
          (ch != ':' && (! dash || ch != '-')))
        break;
    }

    for (; i < strlen; i++) {
      if (! Character.isWhitespace(ch = string.charAt(i)) &&
          (ch != ':' && (! dash || ch != '-')))
        cb.append((char) ch);
      else
        break;
    }

    if (cb.length() == 0)
      throw new Exception();

    return i;
  }
554611
final public Selector ComparisonPredicate() throws ParseException {
                                   Selector left, right; int op;
    left = Expression();
    op = ComparisonOperator();
    right = Expression();
    {if (true) return new OperatorImpl(op, left, right);}
    throw new Error("Missing return statement in function");
  }
1215058
private int readArgumentIndex(final String pattern, final ParsePosition pos) {
        final int start = pos.getIndex();
        seekNonWs(pattern, pos);
        final StringBuilder result = new StringBuilder();
        boolean error = false;
        for (; !error && pos.getIndex() < pattern.length(); next(pos)) {
            char c = pattern.charAt(pos.getIndex());
            if (Character.isWhitespace(c)) {
                seekNonWs(pattern, pos);
                c = pattern.charAt(pos.getIndex());
                if (c != START_FMT && c != END_FE) {
                    error = true;
                    continue;
                }
            }
            if ((c == START_FMT || c == END_FE) && result.length() > 0) {
                try {
                    return Integer.parseInt(result.toString());
                } catch (final NumberFormatException e) { // NOPMD
                    // we've already ensured only digits, so unless something
                    // outlandishly large was specified we should be okay.
                }
            }
            error = !Character.isDigit(c);
            result.append(c);
        }
        if (error) {
            throw new IllegalArgumentException(
                    "Invalid format argument index at position " + start + ": "
                            + pattern.substring(start, pos.getIndex()));
        }
        throw new IllegalArgumentException(
                "Unterminated format element at position " + start);
    }
217605
public List<Object> parse(final String input, final List<String> operators) {
		final List<Object> result = new ArrayList<Object>();
		if (operators.size() != 0) {
			final boolean innerLoop = operators.size() == 1;
			final MiniParser currentParser = innerLoop ? INNER_MINI_PARSER
					: MINI_PARSER;
			final String operator = operators.get(0);
			final List<String> segments;
			if (operator.length() == 1) {
				segments = currentParser.split(input, operator.charAt(0));
			} else if (operator.length() == 2) {

				List<String> allSegments = currentParser.scan(input, String
						.valueOf(operator.charAt(0)), String.valueOf(operator
						.charAt(1)), true);
				if (allSegments.size() > 0) {
					// the first part is not processed any further
					result.add(allSegments.get(0));
				}
				if (allSegments.size() > 1) {
					segments = allSegments.subList(1, allSegments.size());
				} else {
					segments = Collections.emptyList();
				}

			} else {
				throw new IllegalArgumentException(
						"Operators must either be start/end pairs or single characters");

			}
			if (innerLoop) {
				result.addAll(segments);
			} else {
				for (String segment : segments) {
					List<Object> parse = parse(segment, operators.subList(1,
							operators.size()));
					if (parse.size() == 1 && parse.get(0) instanceof String) {
						result.add(parse.get(0));
					} else {
						result.add(parse);
					}
				}
			}
		}
		return result;
	}
725657
public static void main( String... args )
    {
        System.out.println( "Display parameters as parsed by Maven (in canonical form) and comparison result:" );
        if ( args.length == 0 )
        {
            return;
        }

        ComparableVersion prev = null;
        int i = 1;
        for ( String version : args )
        {
            ComparableVersion c = new ComparableVersion( version );

            if ( prev != null )
            {
                int compare = prev.compareTo( c );
                System.out.println( "   " + prev.toString() + ' '
                    + ( ( compare == 0 ) ? "==" : ( ( compare < 0 ) ? "<" : ">" ) ) + ' ' + version );
            }

            System.out.println( String.valueOf( i++ ) + ". " + version + " == " + c.getCanonical() );

            prev = c;
        }
    }
693639
public List<List<Selector>> scan() throws ScannerException {
		char[] data = input.toCharArray();
		int cs;
		int top;
		int[] stack = new int[32];
		int eof = data.length;
		int p = 0;
		int pe = eof;
		
	    int mark = 0;
	    
	    LinkedList<List<Selector>> selectors = new LinkedList<List<Selector>>();
	    // List<Selector> parts = new LinkedList<Selector>();
            List<Selector> parts = null;

	    String tagName = Selector.UNIVERSAL_TAG;
	    String negationTagName = Selector.UNIVERSAL_TAG;
	    Selector.Combinator combinator = null;
	    List<Specifier> specifiers = new LinkedList<Specifier>();
		
		String attributeName = null;
		String attributeValue = null;
		AttributeSpecifier.Match attributeMatch = null;

		String pseudoNthClass = null;
		
		boolean isNegation = false;
		Selector negationSelector = null;
		
		
// line 1538 "../java/se/fishtank/css/selectors/scanner/Scanner.java"
	{
	cs = Scanner_start;
	top = 0;
	}

// line 221 "Scanner.java.rl"
		
// line 1546 "../java/se/fishtank/css/selectors/scanner/Scanner.java"
	{
	int _klen;
	int _trans = 0;
	int _acts;
	int _nacts;
	int _keys;
	int _goto_targ = 0;

	_goto: while (true) {
	switch ( _goto_targ ) {
	case 0:
	if ( p == pe ) {
		_goto_targ = 4;
		continue _goto;
	}
	if ( cs == 0 ) {
		_goto_targ = 5;
		continue _goto;
	}
case 1:
	_match: do {
	_keys = _Scanner_key_offsets[cs];
	_trans = _Scanner_index_offsets[cs];
	_klen = _Scanner_single_lengths[cs];
	if ( _klen > 0 ) {
		int _lower = _keys;
		int _mid;
		int _upper = _keys + _klen - 1;
		while (true) {
			if ( _upper < _lower )
				break;

			_mid = _lower + ((_upper-_lower) >> 1);
			if ( data[p] < _Scanner_trans_keys[_mid] )
				_upper = _mid - 1;
			else if ( data[p] > _Scanner_trans_keys[_mid] )
				_lower = _mid + 1;
			else {
				_trans += (_mid - _keys);
				break _match;
			}
		}
		_keys += _klen;
		_trans += _klen;
	}

	_klen = _Scanner_range_lengths[cs];
	if ( _klen > 0 ) {
		int _lower = _keys;
		int _mid;
		int _upper = _keys + (_klen<<1) - 2;
		while (true) {
			if ( _upper < _lower )
				break;

			_mid = _lower + (((_upper-_lower) >> 1) & ~1);
			if ( data[p] < _Scanner_trans_keys[_mid] )
				_upper = _mid - 2;
			else if ( data[p] > _Scanner_trans_keys[_mid+1] )
				_lower = _mid + 2;
			else {
				_trans += ((_mid - _keys)>>1);
				break _match;
			}
		}
		_trans += _klen;
	}
	} while (false);

	_trans = _Scanner_indicies[_trans];
	cs = _Scanner_trans_targs[_trans];

	if ( _Scanner_trans_actions[_trans] != 0 ) {
		_acts = _Scanner_trans_actions[_trans];
		_nacts = (int) _Scanner_actions[_acts++];
		while ( _nacts-- > 0 )
	{
			switch ( _Scanner_actions[_acts++] )
			{
	case 0:
// line 44 "Scanner.java.rl"
	{
	    AttributeSpecifier specifier;
	    if (attributeValue != null) {
	        specifier = new AttributeSpecifier(attributeName, attributeValue, attributeMatch);
	    } else {
	        specifier = new AttributeSpecifier(attributeName);
	    }
	    
	    specifiers.add(specifier);
	}
	break;
	case 1:
// line 55 "Scanner.java.rl"
	{
	    attributeName = getSlice(mark, p);
	}
	break;
	case 2:
// line 59 "Scanner.java.rl"
	{
	    String m = getSlice(mark, p);
	    if ("=".equals(m)) {
	        attributeMatch = AttributeSpecifier.Match.EXACT;
	    } else if ("~=".equals(m)) {
	        attributeMatch = AttributeSpecifier.Match.LIST;
	    } else if ("|=".equals(m)) {
	        attributeMatch = AttributeSpecifier.Match.HYPHEN;
	    } else if ("^=".equals(m)) {
	        attributeMatch = AttributeSpecifier.Match.PREFIX;
	    } else if ("$=".equals(m)) {
	        attributeMatch = AttributeSpecifier.Match.SUFFIX;
	    } else if ("*=".equals(m)) {
	        attributeMatch = AttributeSpecifier.Match.CONTAINS;
	    }
	}
	break;
	case 3:
// line 76 "Scanner.java.rl"
	{
	    String value = getSlice(mark, p);
	    if (value.charAt(0) == '"' || value.charAt(0) == '\'') {
	        value = value.substring(1, value.length() - 1); 
	    }
	        
	    attributeValue = value;
	}
	break;
	case 4:
// line 85 "Scanner.java.rl"
	{
	    specifiers.add(new AttributeSpecifier("class",
	        getSlice(mark, p), AttributeSpecifier.Match.LIST));
	}
	break;
	case 5:
// line 90 "Scanner.java.rl"
	{
	    switch (data[p]) {
	    case ' ':
	        combinator = Selector.Combinator.DESCENDANT;
	        break;
	    case '>':
	        combinator = Selector.Combinator.CHILD;
	        break;
	    case '+':
	        combinator = Selector.Combinator.ADJACENT_SIBLING;
	        break;
	    case '~':
	        combinator = Selector.Combinator.GENERAL_SIBLING;
	        break;
	    }
	}
	break;
	case 6:
// line 107 "Scanner.java.rl"
	{
	    parts = new LinkedList<Selector>();
	}
	break;
	case 7:
// line 111 "Scanner.java.rl"
	{
	    selectors.add(parts);
	}
	break;
	case 8:
// line 115 "Scanner.java.rl"
	{
	    specifiers.add(new AttributeSpecifier("id",
	        getSlice(mark, p), AttributeSpecifier.Match.EXACT));
	}
	break;
	case 9:
// line 120 "Scanner.java.rl"
	{
	    mark = p;
	}
	break;
	case 10:
// line 124 "Scanner.java.rl"
	{
	    isNegation = true;
	}
	break;
	case 11:
// line 128 "Scanner.java.rl"
	{
	    specifiers.add(new NegationSpecifier(negationSelector));
	    isNegation = false;
	}
	break;
	case 12:
// line 133 "Scanner.java.rl"
	{
            specifiers.add(new PseudoClassSpecifier(getSlice(mark, p)));	  
	}
	break;
	case 13:
// line 137 "Scanner.java.rl"
	{
	    specifiers.add(new PseudoNthSpecifier(pseudoNthClass, getSlice(mark, p)));
	}
	break;
	case 14:
// line 141 "Scanner.java.rl"
	{
	    pseudoNthClass = getSlice(mark, p);
	}
	break;
	case 15:
// line 145 "Scanner.java.rl"
	{
	    Selector selector;
	    List<Specifier> list = specifiers.isEmpty() ? null : specifiers;
	    if (isNegation) {
	        negationSelector = new Selector(negationTagName, list);
	    } else {
	        if (combinator == null) {
	            selector = new Selector(tagName, list);
	        } else {
	            selector = new Selector(tagName, combinator, list);
	        }
	        
	        parts.add(selector);
	        tagName = Selector.UNIVERSAL_TAG;
	        combinator = null;
	    }
	    
	    negationTagName = Selector.UNIVERSAL_TAG;
	    attributeName = null;
	    attributeValue = null;
	    attributeMatch = null;
	    pseudoNthClass = null;
	    specifiers = new LinkedList<Specifier>();
	}
	break;
	case 16:
// line 170 "Scanner.java.rl"
	{
	    if (isNegation) {
	        negationTagName = getSlice(mark, p);
	    } else {
	        tagName = getSlice(mark, p);
	    }
	}
	break;
	case 17:
// line 28 "ScannerCommon.rl"
	{ {stack[top++] = cs; cs = 150; _goto_targ = 2; if (true) continue _goto;} }
	case 18:
// line 42 "ScannerCommon.rl"
	{ {cs = stack[--top];_goto_targ = 2; if (true) continue _goto;} }
// line 1802 "../java/se/fishtank/css/selectors/scanner/Scanner.java"
			}
		}
	}

case 2:
	if ( cs == 0 ) {
		_goto_targ = 5;
		continue _goto;
	}
	if ( ++p != pe ) {
		_goto_targ = 1;
		continue _goto;
	}
case 4:
	if ( p == eof )
	{
	int __acts = _Scanner_eof_actions[cs];
	int __nacts = (int) _Scanner_actions[__acts++];
	while ( __nacts-- > 0 ) {
		switch ( _Scanner_actions[__acts++] ) {
	case 4:
// line 85 "Scanner.java.rl"
	{
	    specifiers.add(new AttributeSpecifier("class",
	        getSlice(mark, p), AttributeSpecifier.Match.LIST));
	}
	break;
	case 7:
// line 111 "Scanner.java.rl"
	{
	    selectors.add(parts);
	}
	break;
	case 8:
// line 115 "Scanner.java.rl"
	{
	    specifiers.add(new AttributeSpecifier("id",
	        getSlice(mark, p), AttributeSpecifier.Match.EXACT));
	}
	break;
	case 12:
// line 133 "Scanner.java.rl"
	{
            specifiers.add(new PseudoClassSpecifier(getSlice(mark, p)));	  
	}
	break;
	case 15:
// line 145 "Scanner.java.rl"
	{
	    Selector selector;
	    List<Specifier> list = specifiers.isEmpty() ? null : specifiers;
	    if (isNegation) {
	        negationSelector = new Selector(negationTagName, list);
	    } else {
	        if (combinator == null) {
	            selector = new Selector(tagName, list);
	        } else {
	            selector = new Selector(tagName, combinator, list);
	        }
	        
	        parts.add(selector);
	        tagName = Selector.UNIVERSAL_TAG;
	        combinator = null;
	    }
	    
	    negationTagName = Selector.UNIVERSAL_TAG;
	    attributeName = null;
	    attributeValue = null;
	    attributeMatch = null;
	    pseudoNthClass = null;
	    specifiers = new LinkedList<Specifier>();
	}
	break;
	case 16:
// line 170 "Scanner.java.rl"
	{
	    if (isNegation) {
	        negationTagName = getSlice(mark, p);
	    } else {
	        tagName = getSlice(mark, p);
	    }
	}
	break;
// line 1886 "../java/se/fishtank/css/selectors/scanner/Scanner.java"
		}
	}
	}

case 5:
	}
	break; }
	}

// line 222 "Scanner.java.rl"
		
		if (cs < Scanner_first_final && p != pe) {
		    // TODO: Better error reporting ;)
			throw new ScannerException("Bad input!");
		}
		
		return selectors;
	}
1165805
@Override
  public IScan getScanByNumLower(int scanNum) {
    IScan scan = getNum2scan().lowerEntry(scanNum).getValue();
    if (scan != null) {
      return scan;
    }
    return null;
  }
254772
public String typeArgument() throws RecognitionException {
        String typeArgument = "";
        try {
            int first = input.index(), last = first;
            int next = input.LA(1);
            switch (next) {
                case DRL6Lexer.QUESTION:
                    match(input,
                            DRL6Lexer.QUESTION,
                            null,
                            null,
                            DroolsEditorType.SYMBOL);
                    if (state.failed)
                        return typeArgument;

                    if (helper.validateIdentifierKey(DroolsSoftKeywords.EXTENDS)) {
                        match(input,
                                DRL6Lexer.ID,
                                DroolsSoftKeywords.EXTENDS,
                                null,
                                DroolsEditorType.SYMBOL);
                        if (state.failed)
                            return typeArgument;

                        type();
                        if (state.failed)
                            return typeArgument;
                    } else if (helper.validateIdentifierKey(DroolsSoftKeywords.SUPER)) {
                        match(input,
                                DRL6Lexer.ID,
                                DroolsSoftKeywords.SUPER,
                                null,
                                DroolsEditorType.SYMBOL);
                        if (state.failed)
                            return typeArgument;
                        type();
                        if (state.failed)
                            return typeArgument;
                    }
                    break;
                case DRL6Lexer.ID:
                    type();
                    if (state.failed)
                        return typeArgument;
                    break;
                default:
                    // TODO: raise error
            }
            last = input.LT(-1).getTokenIndex();
            typeArgument = input.toString(first,
                    last);
        } catch (RecognitionException re) {
            reportError(re);
        }
        return typeArgument;
    }
1051897
public Token next() throws ScanException {
		if (token != null) {
			position += token.getSize();
		}
	
		int length = input.length();
				
		if (isEval()) {
			while (position < length && Character.isWhitespace(input.charAt(position))) {
				position++;
			}
		}

		if (position == length) {
			return token = fixed(Symbol.EOF);
		}

		return token = nextToken();
	}
614811
private AstParameter parseList() {
    eatChar('[');
    char nextChar = skipWS();
    AstParameter res = isQuote(nextChar)? parseStringList() : parseNumList();
    eatChar(']');
    return res;
  }
1360738
public static Map<String, String> parseArgs(String[] args) {
        Map<String, String> argsMap = new HashMap<>();
        if (null == args || args.length == 0) {
            return argsMap;
        }
        for (String arg : args) {
            if (arg.startsWith("--") && arg.contains("=")) {
                String[] param = arg.substring(2).split("=");
                argsMap.put(param[0], param[1]);
            }
        }
        return argsMap;
    }