Parse the string `text` containing a YANG statement.

        Return a Statement on success or None on failure
546445
def parse(self, ctx, ref, text):
        

        self.ctx = ctx
        self.pos = error.Position(ref)
        self.top = None
        try:
            self.tokenizer = YangTokenizer(text, self.pos, ctx.errors,
                                           ctx.max_line_len, ctx.keep_comments,
                                           not ctx.lax_quote_checks)
            stmt = self._parse_statement(None)
        except error.Abort:
            return None
        except error.Eof as e:
            error.err_add(self.ctx.errors, self.pos, 'EOF_ERROR', ())
            return None
        try:
            # we expect a error.Eof at this point, everything else is an error
            self.tokenizer.peek()
        except error.Eof:
            return stmt
        except:
            pass
        error.err_add(self.ctx.errors, self.pos, 'TRAILING_GARBAGE', ())
        return None
581370
def parse(self, string, all_combos=False):
        
        if not all_combos:
            return self.default_parse(string)
        else:
            return self.all_combinations(string)
376259
def _parse_content(self, text):
        ''''''
        try:
            return super(OrphanHALNavigator, self)._parse_content(text)
        except exc.UnexpectedlyNotJSON:
            return {}
1127113
function parse(text) {
  const compCount = U.countComponents(text);
  if (!compCount) {
    return; // undefined
  }

  const len = text.length,
    components = new Array(compCount);

  let multiplier = 1,
    pos = 0,
    nextComp = 0;

  //console.log(`parsing unit ${text}:`);
  while (pos < len) {
    let ch = text.charCodeAt(pos);

    if (ch === U.slash) {
      multiplier *= -1;
      pos++;
    } else if (ch === U.asterisk) {
      pos++;
    }

    let s = pos;
    for (; pos < len; pos++) {
      ch = text.charCodeAt(pos);

      if (!U.isLetter(ch)) {
        break;
      }
    }

    const name = text.substring(s, pos);
    const unitType = bySid[name];
    if (!unitType) {
      throw new Error(`Unknown unit type "${name}" in "${text}"`);
    }

    if (pos < len && text.charCodeAt(pos) === U.caret) {
      pos++;
    }

    s = pos;
    if (pos < len && text.charCodeAt(pos) === U.minus) {
      pos++;
    }

    while (pos < len && U.isDigit(text.charCodeAt(pos))) {
      pos++;
    }

    const degreeText = text.substring(s, pos);

    let degree;
    if (!degreeText.length) {
      degree = 1;
    } else {
      degree = Number.parseInt(degreeText);
      if (isNaN(degree)) {
        throw new Error(`Illegal degree "${degreeText}" in "${text}"`);
      }
    }

    degree *= multiplier;

    let ci = 0;
    for (; ci < nextComp; ci++) {
      const comp = components[ci];

      if (comp.unitType === unitType) {
        comp.degree += degree;
        break;
      }
    }

    if (ci >= nextComp) {
      components[nextComp++] = new UnitTypeDegree(unitType, degree);
    }

    //console.log(` + ${name} ==> ${degree}`);
  }

  components.length = nextComp;
  return parseComponents(components);
}
736126
public void parseLongestText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
    {
        int length = text.length();
        for (int i = 0; i < length; ++i)
        {
            BaseNode<V> state = transition(text.charAt(i));
            if (state != null)
            {
                int to = i + 1;
                int end = to;
                V value = state.getValue();
                for (; to < length; ++to)
                {
                    state = state.transition(text.charAt(to));
                    if (state == null) break;
                    if (state.getValue() != null)
                    {
                        value = state.getValue();
                        end = to + 1;
                    }
                }
                if (value != null)
                {
                    processor.hit(i, end, value);
                    i = end - 1;
                }
            }
        }
    }
660391
private static Long parseLong(final String text) {
		if (text.length() == 0) {
			return null;
		} else {
			try {
				return Long.parseLong(text);
			} catch (NumberFormatException ex) {
				return null;
			}
		}
	}
750381
public static VariantAnnotation parse(String text) {
        if (text != null) {
            return parse(Arrays.asList(text.split("\n")));
        }
        return null;
    }
1157427
private String processText(String text) {
        String rslt = text; // default
        Expression x =
                portalSpELService.parseExpression(
                        text, PortalSpELServiceImpl.TemplateParserContext.INSTANCE);
        rslt = x.getValue(ctx, String.class);
        return rslt;
    }
806528
def _parse_text(v, header_d):
    

    v = nullify(v)

    if v is None:
        return None

    try:
        return six.text_type(v).strip()
    except Exception as e:
        raise CastingError(six.text_type, header_d, v, str(e))
1359974
def parse(text):
    
    found = re.findall(r'(?<=BEGIN_DEPENDENCIES_SCHEMA_OUTPUT>).*(?=<END_DEPENDENCIES_SCHEMA_OUTPUT)', text)

    dependency_results = []

    for match in found:
        data = json.loads(match)

        validate(data)  # will throw ValidationError if invalid

        dependency_results += data['dependencies']

    # we don't have any other fields yet, but in the future
    # may have schema 'version' in which case we'd want to check
    # the versions and compile all the results into 1 schema?

    combined_results = {'dependencies': dependency_results}

    return combined_results
827508
public Object parse(String text) throws DataValidationException {
        try {
            preValidate(text);
            Object object = _valueOf.invoke(text);
            postValidate(object);
            return object;
        } catch (DataValidationException x) {
            throw x;
        } catch (IllegalArgumentException x) {
            // various format errors from valueOf() - ignore the details
            throw new DataValidationException("FORMAT", _name, text);
        } catch (Throwable t) {
            throw new DataValidationException("", _name, text, t);
        }
    }
523187
def get_definition(self, name: YangIdentifier,
                       kw: YangIdentifier) -> Optional["Statement"]:
        
        stmt = self.superstmt
        while stmt:
            res = stmt.find1(kw, name)
            if res:
                return res
            stmt = stmt.superstmt
        return None
469107
def _parse_content(self, text):
        '''
        '''
        try:
            return json.loads(text)
        except ValueError:
            raise exc.UnexpectedlyNotJSON(
                "The resource at {.uri} wasn't valid JSON", self)
195456
async def text(self,
                   encoding: Optional[str]=None, errors: str='strict') -> str:
        """"""
        if self._body is None:
            await self.read()

        if encoding is None:
            encoding = self.get_encoding()

        return self._body.decode(encoding, errors=errors)
283084
def parse(text: str) -> Docstring:
    
    ret = Docstring()
    if not text:
        return ret

    # Clean according to PEP-0257
    text = inspect.cleandoc(text)

    # Find first title and split on its position
    match = _titles_re.search(text)
    if match:
        desc_chunk = text[: match.start()]
        meta_chunk = text[match.start() :]
    else:
        desc_chunk = text
        meta_chunk = ""

    # Break description into short and long parts
    parts = desc_chunk.split("\n", 1)
    ret.short_description = parts[0] or None
    if len(parts) > 1:
        long_desc_chunk = parts[1] or ""
        ret.blank_after_short_description = long_desc_chunk.startswith("\n")
        ret.blank_after_long_description = long_desc_chunk.endswith("\n\n")
        ret.long_description = long_desc_chunk.strip() or None

    # Split by sections determined by titles
    matches = list(_titles_re.finditer(meta_chunk))
    if not matches:
        return ret
    splits = []
    for j in range(len(matches) - 1):
        splits.append((matches[j].end(), matches[j + 1].start()))
    splits.append((matches[-1].end(), len(meta_chunk)))

    chunks = {}
    for j, (start, end) in enumerate(splits):
        title = matches[j].group(1)
        if title not in _valid:
            continue
        chunks[title] = meta_chunk[start:end].strip("\n")
    if not chunks:
        return ret

    # Add elements from each chunk
    for title, chunk in chunks.items():
        # Determine indent
        indent_match = re.search(r"^\s+", chunk)
        if not indent_match:
            raise ParseError(f'Can\'t infer indent from "{chunk}"')
        indent = indent_match.group()

        # Check for returns/yeilds (only one element)
        if _sections[title] in ("returns", "yields"):
            part = inspect.cleandoc(chunk)
            ret.meta.append(_build_meta(part, title))
            continue

        # Split based on lines which have exactly that indent
        _re = "^" + indent + r"(?=\S)"
        c_matches = list(re.finditer(_re, chunk, flags=re.M))
        if not c_matches:
            raise ParseError(f'No specification for "{title}": "{chunk}"')
        c_splits = []
        for j in range(len(c_matches) - 1):
            c_splits.append((c_matches[j].end(), c_matches[j + 1].start()))
        c_splits.append((c_matches[-1].end(), len(chunk)))
        for j, (start, end) in enumerate(c_splits):
            part = chunk[start:end].strip("\n")
            ret.meta.append(_build_meta(part, title))

    return ret
178349
def parse(self, text):
        
        gen = self.lexer.lex(text)
        next_val_fn = partial(next, *(gen,))
        token = next_val_fn()
        return self.rule_svg_path(next_val_fn, token)
752817
def parse_text(self, formatted_text):
        
        assert isinstance(formatted_text, FormattedText)
        ret_val = []
        fmt = formatted_text.fmt if self._prev_fmt_closed else self._prev_fmt
        fmt = QtGui.QTextCharFormat(fmt)
        if not self._pending_text:
            stripped_text = formatted_text.txt
        else:
            stripped_text = self._pending_text + formatted_text.txt
            self._pending_text = ''
        while stripped_text:
            try:
                escape_pos = stripped_text.index(self._escape[0])
            except ValueError:
                ret_val.append(Operation('draw', FormattedText(stripped_text, fmt)))
                break
            else:
                if escape_pos != 0:
                    ret_val.append(Operation('draw', FormattedText(stripped_text[:escape_pos], fmt)))
                    stripped_text = stripped_text[escape_pos:]
                    fmt = QtGui.QTextCharFormat(fmt)
            assert stripped_text[0] == self._escape[0]
            while stripped_text and stripped_text[0] == self._escape[0]:
                if self._escape.startswith(stripped_text):
                    # control sequence not complete
                    self._pending_text += stripped_text
                    stripped_text = ''
                    break
                if not stripped_text.startswith(self._escape):
                    # check vt100 escape sequences
                    ctrl_seq = False
                    for alt_seq in self._escape_alts:
                        if stripped_text.startswith(alt_seq):
                            ctrl_seq = True
                            break
                    if not ctrl_seq:
                        # not a control sequence
                        self._pending_text = ''
                        ret_val.append(Operation('draw', FormattedText(stripped_text[:1], fmt)))
                        fmt = QtGui.QTextCharFormat(fmt)
                        stripped_text = stripped_text[1:]
                        continue
                self._pending_text += _mid(stripped_text, 0, self._escape_len)
                stripped_text = stripped_text[self._escape_len:]

                # Non draw related command (cursor/erase)
                if self._pending_text in [self._escape] + self._escape_alts:
                    m = self._supported_commands.match(stripped_text)
                    if m and self._pending_text == self._escape:
                        _, e = m.span()
                        n = m.group('n')
                        cmd = m.group('cmd')
                        if not n:
                            n = 0
                        ret_val.append(Operation(self._commands[cmd], n))
                        self._pending_text = ''
                        stripped_text = stripped_text[e:]
                        continue
                    else:
                        m = self._unsupported_command.match(stripped_text)
                        if m:
                            self._pending_text = ''
                            stripped_text = stripped_text[m.span()[1]:]
                            continue
                        elif self._pending_text in ['\x1b=', '\x1b>']:
                            self._pending_text = ''
                            continue

                # Handle Select Graphic Rendition commands
                # get the number
                str_nbr = ''
                numbers = []
                while stripped_text:
                    if stripped_text[0].isdigit():
                        str_nbr += stripped_text[0]
                    else:
                        if str_nbr:
                            numbers.append(str_nbr)
                        if not str_nbr or stripped_text[0] != self._semicolon:
                            break
                        str_nbr = ''
                    self._pending_text += _mid(stripped_text, 0, 1)
                    stripped_text = stripped_text[1:]

                if not stripped_text:
                    break

                # remove terminating char
                if not stripped_text.startswith(self._color_terminator):
                    # _logger().warn('removing %s', repr(self._pending_text + stripped_text[0]))
                    self._pending_text = ''
                    stripped_text = stripped_text[1:]
                    break

                # got consistent control sequence, ok to clear pending text
                self._pending_text = ''
                stripped_text = stripped_text[1:]

                if not numbers:
                    fmt = QtGui.QTextCharFormat(formatted_text.fmt)
                    self.end_format_scope()

                i_offset = 0
                n = len(numbers)
                for i in range(n):
                    i += i_offset
                    code = int(numbers[i])

                    if self._TextColorStart <= code <= self._TextColorEnd:
                        fmt.setForeground(_ansi_color(code - self._TextColorStart, self.color_scheme))
                        self._set_format_scope(fmt)
                    elif self._BackgroundColorStart <= code <= self._BackgroundColorEnd:
                        fmt.setBackground(_ansi_color(code - self._BackgroundColorStart, self.color_scheme))
                        self._set_format_scope(fmt)
                    else:
                        if code == self._ResetFormat:
                            fmt = QtGui.QTextCharFormat(formatted_text.fmt)
                            self.end_format_scope()
                        elif code == self._BoldText:
                            fmt.setFontWeight(QtGui.QFont.Bold)
                            self._set_format_scope(fmt)
                        elif code == self._NotBold:
                            fmt.setFontWeight(QtGui.QFont.Normal)
                            self._set_format_scope(fmt)
                        elif code == self._ItalicText:
                            fmt.setFontItalic(True)
                            self._set_format_scope(fmt)
                        elif code == self._NotItalicNotFraktur:
                            fmt.setFontItalic(False)
                            self._set_format_scope(fmt)
                        elif code == self._UnderlinedText:
                            fmt.setUnderlineStyle(fmt.SingleUnderline)
                            fmt.setUnderlineColor(fmt.foreground().color())
                            self._set_format_scope(fmt)
                        elif code == self._NotUnderlined:
                            fmt.setUnderlineStyle(fmt.NoUnderline)
                            self._set_format_scope(fmt)
                        elif code == self._DefaultTextColor:
                            fmt.setForeground(formatted_text.fmt.foreground())
                            self._set_format_scope(fmt)
                        elif code == self._DefaultBackgroundColor:
                            fmt.setBackground(formatted_text.fmt.background())
                            self._set_format_scope(fmt)
                        elif code == self._Dim:
                            fmt = QtGui.QTextCharFormat(fmt)
                            fmt.setForeground(fmt.foreground().color().darker(self.DIM_FACTOR))
                        elif code == self._Negative:
                            normal_fmt = fmt
                            fmt = QtGui.QTextCharFormat(fmt)
                            fmt.setForeground(normal_fmt.background())
                            fmt.setBackground(normal_fmt.foreground())
                        elif code == self._Positive:
                            fmt = QtGui.QTextCharFormat(formatted_text.fmt)
                        elif code in [self._RgbBackgroundColor, self._RgbTextColor]:
                            # See http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
                            i += 1
                            if i == n:
                                break
                            next_code = int(numbers[i])
                            if next_code == 2:
                                # RGB set with format: 38;2;<r>;<g>;<b>
                                if i + 3 < n:
                                    method = fmt.setForeground if code == self._RgbTextColor else fmt.setBackground
                                    method(QtGui.QColor(int(numbers[i + 1]), int(numbers[i + 2]), int(numbers[i + 3])))
                                    self._set_format_scope(fmt)
                                i_offset = 3
                            elif next_code == 5:
                                # 256 color mode with format: 38;5;<i>
                                index = int(numbers[i + 1])
                                if index < 8:
                                    # The first 8 colors are standard low-intensity ANSI colors.
                                    color = _ansi_color(index, self.color_scheme)
                                elif index < 16:
                                    # The next 8 colors are standard high-intensity ANSI colors.
                                    color = _ansi_color(index - 8, self.color_scheme).lighter(150)
                                elif index < 232:
                                    # The next 216 colors are a 6x6x6 RGB cube.
                                    o = index - 16
                                    color = QtGui.QColor((o / 36) * 51, ((o / 6) % 6) * 51, (o % 6) * 51)
                                else:
                                    # The last 24 colors are a greyscale gradient.
                                    grey = (index - 232) * 11
                                    color = QtGui.QColor(grey, grey, grey)

                                if code == self._RgbTextColor:
                                    fmt.setForeground(color)
                                else:
                                    fmt.setBackground(color)

                                self._set_format_scope(fmt)
                        else:
                            _logger().warn('unsupported SGR code: %r', code)
        return ret_val