Parse a TAP line.

@param tapLine TAP line
767129
public void parseLine(String tapLine) {

        TapElement tapElement = TapElementFactory.createTapElement(tapLine);

        if (tapElement == null || state.isInYaml()) {

            String trimmedLine = tapLine.trim();
            Text text = TapElementFactory.createTextElement(tapLine);

            if (state.isInYaml()) {

                boolean yamlEndMarkReached = trimmedLine.equals("...") && (
                           tapLine.equals(state.getYamlIndentation() + "...")
                        || text.getIndentation() < state.getYamlIndentation().length());

                if (yamlEndMarkReached) {
                    state.setInYaml(false);
                    parseDiagnostics();
                } else {
                    state.getDiagnosticBuffer().append(tapLine);
                    state.getDiagnosticBuffer().append('\n');
                }
            } else {
                if (trimmedLine.equals("---")) {
                    if (text.getIndentation() < baseIndentation) {
                        throw new ParserException(String.format("Invalid indentation. Check your TAP Stream. Line: %s",
                                tapLine));
                    }
                    state.setInYaml(true);
                    state.setYamlIndentation(text.getIndentationString());
                } else {
                    state.getTestSet().getTapLines().add(text);
                    state.setLastParsedElement(text);
                }
            }
            return;
        }

        int indentation = tapElement.getIndentation();

        if (indentation < baseIndentation) {
            baseIndentation = indentation;
        }

        StreamStatus prevState = null;
        if (indentation != state.getIndentationLevel() && enableSubtests) { // indentation changed

            if (indentation > state.getIndentationLevel()) {
                int prevIndent = state.getIndentationLevel();
                pushState(indentation); // make room for children
                if (indentation - prevIndent > 4)
                    subStack.push(state);
            } else {
                // going down
                if (states.peek().getIndentationLevel() == indentation) {
                    prevState = state;
                    state = states.pop();
                } else {
                    state = new StreamStatus();
                    state.setIndentationLevel(indentation);
                    subStack.push(state);
                }
            }
        }

        if (tapElement instanceof Header) {

            if (state.getTestSet().getHeader() != null) {
                throw new ParserException("Duplicated TAP Header found.");
            }
            if (!state.isFirstLine()) {
                throw new ParserException(
                        "Invalid position of TAP Header. It must be the first "
                                + "element (apart of Comments) in the TAP Stream.");
            }
            state.getTestSet().setHeader((Header) tapElement);

        } else if (tapElement instanceof Plan) {

            Plan currentPlan = (Plan) tapElement;

            if (state.getTestSet().getPlan() != null) {
                if (currentPlan.getInitialTestNumber() != 1 || currentPlan.getLastTestNumber() != 0) {
                    throw new ParserException("Duplicated TAP Plan found.");
                }
            } else {
                state.getTestSet().setPlan(currentPlan);
            }

            if (state.getTestSet().getTestResults().size() <= 0
                    && state.getTestSet().getBailOuts().size() <= 0) {
                state.setPlanBeforeTestResult(true);
            }

        } else if (tapElement instanceof TestResult) {

            parseDiagnostics();

            final TestResult testResult = (TestResult) tapElement;
            if (testResult.getTestNumber() == 0) {
                if (state.getTestSet().getPlan() != null && !state.isPlanBeforeTestResult()) {
                    return; // done testing mark
                }
                if (state.getTestSet().getPlan() != null &&
                    state.getTestSet().getPlan().getLastTestNumber() == state.getTestSet().getTestResults().size()) {
                    return; // done testing mark but plan before test result
                }
                testResult.setTestNumber(state.getTestSet().getNextTestNumber());
            }

            state.getTestSet().addTestResult(testResult);

            if (prevState != null && enableSubtests) {
                state.getTestSet().getTestResults().get(
                        state.getTestSet().getNumberOfTestResults() - 1)
                        .setSubtest(prevState.getTestSet());
            }

            if (indentation == 0 && enableSubtests) {
                TestResult currLast = state.getTestSet().getTestResults().get(
                            state.getTestSet().getNumberOfTestResults() - 1);
                while (!subStack.empty()) {
                    StreamStatus nextLevel = subStack.pop();
                    currLast.setSubtest(nextLevel.getTestSet());
                    currLast = nextLevel.getTestSet().getTestResults().get(0);
                }
            }

        } else if (tapElement instanceof Footer) {

            state.getTestSet().setFooter((Footer) tapElement);

        } else if (tapElement instanceof BailOut) {

            state.getTestSet().addBailOut((BailOut) tapElement);

        } else if (tapElement instanceof Comment) {

            final Comment comment = (Comment) tapElement;

            state.getTestSet().addComment(comment);

            if (state.getLastParsedElement() instanceof TestResult) {
                ((TestResult) state.getLastParsedElement()).addComment(comment);
            }
        }

        state.setFirstLine(false);
        if (!(tapElement instanceof Comment)) {
            state.setLastParsedElement(tapElement);
        }
    }
1132810
public function parse()
    {
        // Split up the TAP string into an array of lines, then
        // trim all of the lines so there's no leading or trailing whitespace.
        $this->lines = array_map('rtrim', explode("\n", $this->tapString));
        $this->lineNumber = 0;

        $this->testCount = false;
        $this->results = array();

        $header = $this->findTapLog();

        $line = $this->nextLine();
        if ($line === $header) {
            throw new Exception("Duplicated TAP log, please check the configuration.");
        }

        while ($line !== false && ($this->testCount === false || count($this->results) < $this->testCount)) {
            $this->parseLine($line);
            $line = $this->nextLine();
        }

        if (false !== $this->testCount && count($this->results) !== $this->testCount) {
            throw new Exception(Lang::get('tap_error'));
        }

        return $this->results;
    }
975084
public static String[] parse(final String line) {
        boolean insideQuote = false;
        final ArrayList<String> result = new ArrayList<>();
        int quoteCount = 0;
        final StringBuilder sb = new StringBuilder();
        for (int i = 0; i < line.length(); i++) {
            final char c = line.charAt(i);

            if (c == QUOTE) {
                insideQuote = !insideQuote;
                quoteCount++;
            }

            if (c == COMMA && !insideQuote) {
                String value = sb.toString();
                value = unQuoteUnEscape(value);
                result.add(value);
                sb.setLength(0);
                continue;
            }

            sb.append(c);
        }

        result.add(sb.toString());

        // Validate
        if (quoteCount % 2 != 0) {
            return new String[0];
        }

        return result.toArray(new String[result.size()]);
    }
615363
private void parseLine(final String line, final DataModelIF<Long, Long> dataset) {
        String[] toks = line.split("\t");
        // user
        long userId = Long.parseLong(toks[USER_TOK]);
        // item
        long itemId = Long.parseLong(toks[ITEM_TOK]);
        // preference
        double preference = Double.parseDouble(toks[RATING_TOK]);
        //////
        // update information
        //////
        dataset.addPreference(userId, itemId, preference);
        // no timestamp info
    }
8204
private IAtomContainer readSmiles(final String line) {
        try {
            return sp.parseSmiles(line);
        } catch (CDKException e) {
            logger.error("Error while reading the SMILES from: " + line + ", ", e);
            final IAtomContainer empty = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0);
            empty.setProperty(BAD_SMILES_INPUT, line);
            return empty;
        }
    }
1119224
private void parseExtras(Bundle icicle){

        Intent intent = getIntent();
        if(intent != null){
            mXmlConfigId = intent.getIntExtra(EXTRA_CONFIG, -1);
            mTitle = intent.getStringExtra(EXTRA_TITLE);
        }

        if(icicle != null){
            mXmlConfigId = icicle.getInt(EXTRA_CONFIG, -1);
            mTitle = icicle.getString(EXTRA_TITLE);
        }

        if(mXmlConfigId == -1) finish();

        // Set title
        if(!TextUtils.isEmpty(mTitle)) getSupportActionBar().setTitle(mTitle);

        // Apply Configuration
        List<com.ftinc.kit.attributr.model.Library> libs = com.ftinc.kit.attributr.internal.Parser.parse(this, mXmlConfigId);
        mAdapter = new com.ftinc.kit.attributr.ui.LibraryAdapter();
        mAdapter.addAll(libs);
        mAdapter.sort(new com.ftinc.kit.attributr.model.Library.LibraryComparator());
        mAdapter.notifyDataSetChanged();
    }
255185
public static SubstitutedLine parseOperationRequestLine(String commandLine,
            final CommandLineParser.CallbackHandler handler, CommandContext ctx) throws CommandFormatException {
        if (commandLine == null) {
            return null;
        }
        final ParsingStateCallbackHandler callbackHandler = getCallbackHandler(handler);
        handler.setFormat(OperationFormat.INSTANCE);
        return StateParser.parseLine(commandLine, callbackHandler, OperationRequestState.INSTANCE, ctx);
    }
1110619
public void parse(byte[] data) throws ParseException {
        Text text = new Text();
        text.strain(data, 0, data.length);
        init(text);
    }
1353685
public static TApplicationException read(TProtocol iprot) throws TException {
        TField field;
        iprot.readStructBegin();

        String message = null;
        int type = TApplicationException.UNKNOWN;

        while (true) {
            field = iprot.readFieldBegin();
            if (field.type == TType.STOP) {
                break;
            }
            switch (field.id) {
                case 1:
                    if (field.type == TType.STRING) {
                        message = iprot.readString();
                    } else {
                        TProtocolUtil.skip(iprot, field.type);
                    }
                    break;
                case 2:
                    if (field.type == TType.I32) {
                        type = iprot.readI32();
                    } else {
                        TProtocolUtil.skip(iprot, field.type);
                    }
                    break;
                default:
                    TProtocolUtil.skip(iprot, field.type);
                    break;
            }
            iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        return new TApplicationException(type, message);
    }
842523
public List<String> parse(String line) throws ParseException {
    List<String> cols = new ArrayList<>();
    boolean afterQuote = false;
    boolean afterEscape = false;
    boolean afterSeparator = false;
    boolean outerQuote = false;
    boolean afterEndField = false;
    StringBuilder sb = new StringBuilder();

    for (int i = 0; ; ++i) {
      char c = (i == line.length()) ? EOT : line.charAt(i);
      if (afterEndField && c != separator && c != EOT) {
        if (!trim || c != ' ') {
          throw new ParseException("Extraneous character after end of quoted field", i);
        }
      } else if (afterEscape) {
        if (c == EOT) {
          // [abc\^]
          throw new ParseException("Escape not followed by a character", i);
        } else {
          // [abc\x...] => abcx...
          afterEscape = false;
          sb.append(c);
        }
      } else if (c == separator) {
        if (outerQuote && !afterQuote) {
          // ["abc,...] => abc,...
          sb.append(c);
          afterSeparator = false;
        } else {
          // [abc,...] => {abc, ...}
          endCol(cols, sb, i, outerQuote, afterQuote);
          afterQuote = afterEscape = afterEndField = outerQuote = false;
          afterSeparator = true;
        }
      } else if (c == EOT) {
        if (sb.length() != 0 || afterSeparator || outerQuote) {
          // [...,abc^] => {..., abc}
          // [...,^] => {..., ""}
          endCol(cols, sb, i, outerQuote, afterQuote);
        }
        return cols;
      } else if (c == escape) {
        // [...\...]
        afterEscape = true;
        afterSeparator = false;
      } else if (c == quote) {
        if (afterQuote && outerQuote) {
          // Two consecutive quotes inside quoted string, so the pair has to be internal
          // (the second quote cannot be terminating the field).
          sb.append(quote);
          afterQuote = false;
        } else if (sb.length() == 0 && !outerQuote) {
          outerQuote = true;
        } else if (sb.length() != 0 && !outerQuote) {
          // Fields that are not quote-delimited cannot have any internal quotes,
          // unless they are escaped which was already handled.
          throw new ParseException(escape == NUL
              ? "Unescaped quote inside non-quote-delimited field"
              : "Quote inside non-quote-delimited field",
              i);
        } else {
          afterQuote = true;
        }
        afterSeparator = false;
      } else if (c == ' ' && trim
          && ((!outerQuote && sb.length() == 0) // Trimmed space before field
              || afterEndField)) {              // Trimmed space after field
      } else if (c == ' ' && trim && afterQuote) {
        afterEndField = true;
      } else if (outerQuote && afterQuote) {
        // ["abc"x]
        throw new ParseException("Extraneous character after end of quoted field", i);
      } else {
        // Common character.
        sb.append(c);
        afterSeparator = false;
      }
    }
  }
512882
def is_taps_aff(self):
        """"""

        request = requests.get('https://www.taps-aff.co.uk/api/%s' % self.location)
        if request.status_code == 200:
            try:
                taps = request.json()['taps']['status']
                if taps == 'aff':
                    return True
                elif taps == 'oan':
                    return False
                else:
                    raise RuntimeError("Unexpected taps value: %s" % taps)
            except ValueError:
                raise RuntimeError("Unexpected response from service")
        else:
            raise IOError("Failure downloading from Api")
1307852
function (elementId) {
      var element = this.getElement(elementId);
      var errObj = new ERROR.UnknownError(
        'elementId ' + elementId + ' could not be tapped');
      if (element !== null) {
        try {
          // element may still be null.
          element.tap();
        } catch (e) {
          if (e.message.indexOf("(null)") !== -1) {
            try {
              $.target().tap(element.rect());
            } catch (e2) {
              throw errObj;
            }
          } else {
            throw errObj;
          }
        }
      } else {
        throw new ERROR.UnknownError(
          'elementId ' + elementId + ' is null and can\'t be tapped.');
      }
    }
1316359
private void parseAction(Element node, LayoutTrigger parent) {
        new LayoutTriggerAction(parent, getDefinition(null, node));
    }
1031557
public void shutdown() {
    synchronized (omap) {
      for (Map.Entry<TapStream, TapConnectionProvider> me : omap.entrySet()) {
        me.getValue().shutdown();
      }
    }
  }
1335235
public T tap(TapOptions tapOptions) {
        ActionParameter action = new ActionParameter("tap", tapOptions);
        parameterBuilder.add(action);
        return (T) this;
    }
462692
public void parseTagedLine(String line) {
		String[] toks = line.split("(\\s|　| |\\t)+");
		words = new String[toks.length];
		tags = new String[toks.length];
		for(int i=0;i<toks.length;i++){
			String[] tt = toks[i].split("/");
			if(tt.length!=2)
				System.err.println("Wrong Format");
			words[i] = tt[0];
			tags[i]=tt[1];
		}
		
		
	}
124436
@Override
    public boolean onTap(LatLong tapLatLong, Point layerXY, Point tapXY) {
        for (int i = layers.size() - 1; i >= 0; i--) {
            Layer layer = layers.get(i);
            if (layer.onTap(tapLatLong, layerXY, tapXY)) {
                return true;
            }
        }
        return false;
    }