Пример #1
0
gboolean
parse_number_with_suffix(const gchar *s, gint64 *d)
{
  gchar *endptr;

  if (!_parse_number(s, &endptr, DETECT_BASE, d))
    return FALSE;
  return _process_suffix(endptr, d);
}
Пример #2
0
gboolean
parse_dec_number(const gchar *s, gint64 *d)
{
  gchar *endptr;

  if (!_parse_number(s, &endptr, DECIMAL_BASE, d))
    return FALSE;
  if (*endptr)
    return FALSE;
  return TRUE;
}
Пример #3
0
/*
 * Parse operator
 * @param stmt statement
 * @param sym_tbl symbol table
 */
void 
_par::_parse_operator(
	std::vector<token_t> &stmt,
	std::map<std::string, size_t> &sym_tbl
	)
{
	trace(
		PAR_TRACE_ENABLE,
		TRACE_ENTRY,
		"par::parse_operator"
		);

	if(IS_TOK_TYPE(_typ, LEX_TOKEN_REG_KEYWORD)
			|| IS_TOK_TYPE(_typ, LEX_TOKEN_S_REG_KEYWORD)
			|| IS_TOK_TYPE(_typ, LEX_TOKEN_STACK_KEYWORD)) {
		stmt.push_back(lex::get_token());
		next_token();
	} else if(IS_TOK_TYPE(_typ, LEX_TOKEN_NUMBER)
			|| IS_TOK_TYPE(_typ, LEX_TOKEN_HEX_NUMBER)
			|| IS_TOK_TYPE(_typ, LEX_TOKEN_LABEL)) {
		stmt.push_back(lex::get_token());
		++_stmt_pos;
		next_token();
	} else if(IS_TOK_TYPE(_typ, LEX_TOKEN_S_STACK_KEYWORD)
			&& IS_S_STACK_TYPE(_txt, TOK_S_STACK_PICK)) {
		stmt.push_back(lex::get_token());
		++_stmt_pos;
		next_token();
		_parse_number(
			stmt,
			sym_tbl
			);
	} else if(IS_TOK_TYPE(_typ, LEX_TOKEN_SYMBOL)
			&& IS_SYMBOL_TYPE(_txt, TOK_SYMBOL_OPEN_BRACE))
		_parse_memory_operator(
			stmt,
			sym_tbl
			);
	else
		throw std::runtime_error(
			_format_exception(
				PAR_EXC_EXPEC_OPERATOR,
				_txt,
				get_line()
				));
	trace(
		PAR_TRACE_ENABLE,
		TRACE_EXIT,
		"par::parse_operator"
		);
}
Пример #4
0
static GstAmfNode *
_parse_value (AmfParser * parser)
{
  GstAmfNode *node = NULL;
  GstAmfType type;

  type = _parse_u8 (parser);
  node = gst_amf_node_new (type);

  GST_DEBUG ("parsing type %d", type);

  switch (type) {
    case GST_AMF_TYPE_NUMBER:
      gst_amf_node_set_number (node, _parse_number (parser));
      break;
    case GST_AMF_TYPE_BOOLEAN:
      gst_amf_node_set_boolean (node, _parse_u8 (parser));
      break;
    case GST_AMF_TYPE_STRING:
      gst_amf_node_set_string_take (node, _parse_utf8_string (parser));
      break;
    case GST_AMF_TYPE_OBJECT:
      _parse_object (parser, node);
      break;
    case GST_AMF_TYPE_MOVIECLIP:
      GST_ERROR ("unimplemented AMF type: movie clip");
      break;
    case GST_AMF_TYPE_NULL:
      break;
    case GST_AMF_TYPE_ECMA_ARRAY:
      _parse_ecma_array (parser, node);
      break;
    case GST_AMF_TYPE_OBJECT_END:
      break;
    default:
      GST_ERROR ("unimplemented AMF type %d", type);
      break;
  }

  return node;
}