C-sparse

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN


my @names =
  (
   qw(
	TOKEN_EOF
	TOKEN_ERROR
	TOKEN_IDENT
	TOKEN_ZERO_IDENT
	TOKEN_NUMBER
	TOKEN_CHAR
	TOKEN_CHAR_EMBEDDED_0
	TOKEN_CHAR_EMBEDDED_1
	TOKEN_CHAR_EMBEDDED_2
	TOKEN_CHAR_EMBEDDED_3
	TOKEN_WIDE_CHAR
	TOKEN_WIDE_CHAR_EMBEDDED_0
	TOKEN_WIDE_CHAR_EMBEDDED_1
	TOKEN_WIDE_CHAR_EMBEDDED_2
	TOKEN_WIDE_CHAR_EMBEDDED_3
	TOKEN_STRING
	TOKEN_WIDE_STRING
	TOKEN_SPECIAL
	TOKEN_STREAMBEGIN
	TOKEN_STREAMEND
	TOKEN_MACRO_ARGUMENT
	TOKEN_STR_ARGUMENT
	TOKEN_QUOTED_ARGUMENT
	TOKEN_CONCAT
	TOKEN_GNU_KLUDGE

lib/C/sparse.pm  view on Meta::CPAN

    our %EXPORT_TAGS = ( 
	constants =>	
	[qw(

	TOKEN_EOF
	TOKEN_ERROR
	TOKEN_IDENT
	TOKEN_ZERO_IDENT
	TOKEN_NUMBER
	TOKEN_CHAR
	TOKEN_CHAR_EMBEDDED_0
	TOKEN_CHAR_EMBEDDED_1
	TOKEN_CHAR_EMBEDDED_2
	TOKEN_CHAR_EMBEDDED_3
	TOKEN_WIDE_CHAR
	TOKEN_WIDE_CHAR_EMBEDDED_0
	TOKEN_WIDE_CHAR_EMBEDDED_1
	TOKEN_WIDE_CHAR_EMBEDDED_2
	TOKEN_WIDE_CHAR_EMBEDDED_3
	TOKEN_STRING
	TOKEN_WIDE_STRING
	TOKEN_SPECIAL
	TOKEN_STREAMBEGIN
	TOKEN_STREAMEND
	TOKEN_MACRO_ARGUMENT
	TOKEN_STR_ARGUMENT
	TOKEN_QUOTED_ARGUMENT
	TOKEN_CONCAT
	TOKEN_GNU_KLUDGE

lib/C/sparse.pm~  view on Meta::CPAN

    our %EXPORT_TAGS = ( 
	constants =>	
	[qw(

	TOKEN_EOF
	TOKEN_ERROR
	TOKEN_IDENT
	TOKEN_ZERO_IDENT
	TOKEN_NUMBER
	TOKEN_CHAR
	TOKEN_CHAR_EMBEDDED_0
	TOKEN_CHAR_EMBEDDED_1
	TOKEN_CHAR_EMBEDDED_2
	TOKEN_CHAR_EMBEDDED_3
	TOKEN_WIDE_CHAR
	TOKEN_WIDE_CHAR_EMBEDDED_0
	TOKEN_WIDE_CHAR_EMBEDDED_1
	TOKEN_WIDE_CHAR_EMBEDDED_2
	TOKEN_WIDE_CHAR_EMBEDDED_3
	TOKEN_STRING
	TOKEN_WIDE_STRING
	TOKEN_SPECIAL
	TOKEN_STREAMBEGIN
	TOKEN_STREAMEND
	TOKEN_MACRO_ARGUMENT
	TOKEN_STR_ARGUMENT
	TOKEN_QUOTED_ARGUMENT
	TOKEN_CONCAT
	TOKEN_GNU_KLUDGE

lib/C/sparse/tok.pm  view on Meta::CPAN


package C::sparse::tok::TOKEN_ZERO_IDENT;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_NUMBER;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR_EMBEDDED_0;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR_EMBEDDED_1;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR_EMBEDDED_2;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR_EMBEDDED_3;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_0;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_1;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_2;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_3;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_STRING;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_STRING;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_SPECIAL;
our @ISA = qw (C::sparse::tok);

scripts/constdef.pl  view on Meta::CPAN


");

foreach my $v (qw(
	TOKEN_EOF
	TOKEN_ERROR
	TOKEN_IDENT
	TOKEN_ZERO_IDENT
	TOKEN_NUMBER
	TOKEN_CHAR
	TOKEN_CHAR_EMBEDDED_0
	TOKEN_CHAR_EMBEDDED_1
	TOKEN_CHAR_EMBEDDED_2
	TOKEN_CHAR_EMBEDDED_3
	TOKEN_WIDE_CHAR
	TOKEN_WIDE_CHAR_EMBEDDED_0
	TOKEN_WIDE_CHAR_EMBEDDED_1
	TOKEN_WIDE_CHAR_EMBEDDED_2
	TOKEN_WIDE_CHAR_EMBEDDED_3
	TOKEN_STRING
	TOKEN_WIDE_STRING
	TOKEN_SPECIAL
	TOKEN_STREAMBEGIN
	TOKEN_STREAMEND
	TOKEN_MACRO_ARGUMENT
	TOKEN_STR_ARGUMENT
	TOKEN_QUOTED_ARGUMENT
	TOKEN_CONCAT
	TOKEN_GNU_KLUDGE

sparse.xs  view on Meta::CPAN

CREATE_SPARSE(sparsectx,   C::sparse::ctx   , sparse_ctx);
CREATE_SPARSE(sparsestream,C::sparse::stream, stream);

static char *token_types_class[] =  {
	"C::sparse::tok::TOKEN_EOF",
	"C::sparse::tok::TOKEN_ERROR",
	"C::sparse::tok::TOKEN_IDENT",
	"C::sparse::tok::TOKEN_ZERO_IDENT",
	"C::sparse::tok::TOKEN_NUMBER",
	"C::sparse::tok::TOKEN_CHAR",
	"C::sparse::tok::TOKEN_CHAR_EMBEDDED_0",
	"C::sparse::tok::TOKEN_CHAR_EMBEDDED_1",
	"C::sparse::tok::TOKEN_CHAR_EMBEDDED_2",
	"C::sparse::tok::TOKEN_CHAR_EMBEDDED_3",
	"C::sparse::tok::TOKEN_WIDE_CHAR",
	"C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_0",
	"C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_1",
	"C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_2",
	"C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_3",
	"C::sparse::tok::TOKEN_STRING",
	"C::sparse::tok::TOKEN_WIDE_STRING",
	"C::sparse::tok::TOKEN_SPECIAL",
	"C::sparse::tok::TOKEN_STREAMBEGIN",
	"C::sparse::tok::TOKEN_STREAMEND",
	"C::sparse::tok::TOKEN_MACRO_ARGUMENT",
	"C::sparse::tok::TOKEN_STR_ARGUMENT",
	"C::sparse::tok::TOKEN_QUOTED_ARGUMENT",
	"C::sparse::tok::TOKEN_CONCAT",
	"C::sparse::tok::TOKEN_GNU_KLUDGE",

src/sparse-0.4.4/char.c  view on Meta::CPAN

{
	const char *p = token->embedded, *end;
	unsigned v;
	int type = token_type(token);
	switch (type) {
	case TOKEN_CHAR:
	case TOKEN_WIDE_CHAR:
		p = token->string->data;
		end = p + token->string->length;
		break;
	case TOKEN_CHAR_EMBEDDED_0 ... TOKEN_CHAR_EMBEDDED_3:
		end = p + type - TOKEN_CHAR;
		break;
	default:
		end = p + type - TOKEN_WIDE_CHAR;
	}
	p = parse_escape(sctx_ p, &v, end,
			type < TOKEN_WIDE_CHAR ? sctxp bits_in_char : 32, token->pos);
	if (p != end)
		warning(sctx_ token->pos,
			"multi-character character constant");

src/sparse-0.4.4/expression.c  view on Meta::CPAN


Enoint:
	error_die(sctx_ expr->pos->pos, "constant %s is not a valid number", show_token(sctx_ token));
}

struct token *primary_expression(SCTX_ struct token *token, struct expression **tree)
{
	struct expression *expr = NULL;

	switch (token_type(token)) {
	case TOKEN_CHAR ... TOKEN_WIDE_CHAR_EMBEDDED_3:
		expr = alloc_expression(sctx_ token, EXPR_VALUE);   
		expr->flags = Int_const_expr;
		expr->ctype = token_type(token) < TOKEN_WIDE_CHAR ? &sctxp int_ctype : &sctxp long_ctype;
		get_char_constant(sctx_ token, &expr->value);
		token = token->next;
		break;

	case TOKEN_NUMBER:
		expr = alloc_expression(sctx_ token, EXPR_VALUE);
		get_number_value(sctx_ expr, token); /* will see if it's an integer */

src/sparse-0.4.4/perl/Makefile.PL  view on Meta::CPAN


my @names =
  (
   qw(
	TOKEN_EOF
	TOKEN_ERROR
	TOKEN_IDENT
	TOKEN_ZERO_IDENT
	TOKEN_NUMBER
	TOKEN_CHAR
	TOKEN_CHAR_EMBEDDED_0
	TOKEN_CHAR_EMBEDDED_1
	TOKEN_CHAR_EMBEDDED_2
	TOKEN_CHAR_EMBEDDED_3
	TOKEN_WIDE_CHAR
	TOKEN_WIDE_CHAR_EMBEDDED_0
	TOKEN_WIDE_CHAR_EMBEDDED_1
	TOKEN_WIDE_CHAR_EMBEDDED_2
	TOKEN_WIDE_CHAR_EMBEDDED_3
	TOKEN_STRING
	TOKEN_WIDE_STRING
	TOKEN_SPECIAL
	TOKEN_STREAMBEGIN
	TOKEN_STREAMEND
	TOKEN_MACRO_ARGUMENT
	TOKEN_STR_ARGUMENT
	TOKEN_QUOTED_ARGUMENT
	TOKEN_CONCAT
	TOKEN_GNU_KLUDGE

src/sparse-0.4.4/perl/lib/C/sparse.pm  view on Meta::CPAN

    our %EXPORT_TAGS = ( 
	constants =>	
	[qw(

	TOKEN_EOF
	TOKEN_ERROR
	TOKEN_IDENT
	TOKEN_ZERO_IDENT
	TOKEN_NUMBER
	TOKEN_CHAR
	TOKEN_CHAR_EMBEDDED_0
	TOKEN_CHAR_EMBEDDED_1
	TOKEN_CHAR_EMBEDDED_2
	TOKEN_CHAR_EMBEDDED_3
	TOKEN_WIDE_CHAR
	TOKEN_WIDE_CHAR_EMBEDDED_0
	TOKEN_WIDE_CHAR_EMBEDDED_1
	TOKEN_WIDE_CHAR_EMBEDDED_2
	TOKEN_WIDE_CHAR_EMBEDDED_3
	TOKEN_STRING
	TOKEN_WIDE_STRING
	TOKEN_SPECIAL
	TOKEN_STREAMBEGIN
	TOKEN_STREAMEND
	TOKEN_MACRO_ARGUMENT
	TOKEN_STR_ARGUMENT
	TOKEN_QUOTED_ARGUMENT
	TOKEN_CONCAT
	TOKEN_GNU_KLUDGE

src/sparse-0.4.4/perl/lib/C/sparse/tok.pm  view on Meta::CPAN


package C::sparse::tok::TOKEN_ZERO_IDENT;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_NUMBER;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR_EMBEDDED_0;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR_EMBEDDED_1;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR_EMBEDDED_2;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_CHAR_EMBEDDED_3;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_0;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_1;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_2;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_3;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_STRING;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_WIDE_STRING;
our @ISA = qw (C::sparse::tok);

package C::sparse::tok::TOKEN_SPECIAL;
our @ISA = qw (C::sparse::tok);

src/sparse-0.4.4/perl/scripts/constdef.pl  view on Meta::CPAN


");

foreach my $v (qw(
	TOKEN_EOF
	TOKEN_ERROR
	TOKEN_IDENT
	TOKEN_ZERO_IDENT
	TOKEN_NUMBER
	TOKEN_CHAR
	TOKEN_CHAR_EMBEDDED_0
	TOKEN_CHAR_EMBEDDED_1
	TOKEN_CHAR_EMBEDDED_2
	TOKEN_CHAR_EMBEDDED_3
	TOKEN_WIDE_CHAR
	TOKEN_WIDE_CHAR_EMBEDDED_0
	TOKEN_WIDE_CHAR_EMBEDDED_1
	TOKEN_WIDE_CHAR_EMBEDDED_2
	TOKEN_WIDE_CHAR_EMBEDDED_3
	TOKEN_STRING
	TOKEN_WIDE_STRING
	TOKEN_SPECIAL
	TOKEN_STREAMBEGIN
	TOKEN_STREAMEND
	TOKEN_MACRO_ARGUMENT
	TOKEN_STR_ARGUMENT
	TOKEN_QUOTED_ARGUMENT
	TOKEN_CONCAT
	TOKEN_GNU_KLUDGE

src/sparse-0.4.4/perl/sparse.xs  view on Meta::CPAN

CREATE_SPARSE(sparsectx,   C::sparse::ctx   , sparse_ctx);
CREATE_SPARSE(sparsestream,C::sparse::stream, stream);

static char *token_types_class[] =  {
	"C::sparse::tok::TOKEN_EOF",
	"C::sparse::tok::TOKEN_ERROR",
	"C::sparse::tok::TOKEN_IDENT",
	"C::sparse::tok::TOKEN_ZERO_IDENT",
	"C::sparse::tok::TOKEN_NUMBER",
	"C::sparse::tok::TOKEN_CHAR",
	"C::sparse::tok::TOKEN_CHAR_EMBEDDED_0",
	"C::sparse::tok::TOKEN_CHAR_EMBEDDED_1",
	"C::sparse::tok::TOKEN_CHAR_EMBEDDED_2",
	"C::sparse::tok::TOKEN_CHAR_EMBEDDED_3",
	"C::sparse::tok::TOKEN_WIDE_CHAR",
	"C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_0",
	"C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_1",
	"C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_2",
	"C::sparse::tok::TOKEN_WIDE_CHAR_EMBEDDED_3",
	"C::sparse::tok::TOKEN_STRING",
	"C::sparse::tok::TOKEN_WIDE_STRING",
	"C::sparse::tok::TOKEN_SPECIAL",
	"C::sparse::tok::TOKEN_STREAMBEGIN",
	"C::sparse::tok::TOKEN_STREAMEND",
	"C::sparse::tok::TOKEN_MACRO_ARGUMENT",
	"C::sparse::tok::TOKEN_STR_ARGUMENT",
	"C::sparse::tok::TOKEN_QUOTED_ARGUMENT",
	"C::sparse::tok::TOKEN_CONCAT",
	"C::sparse::tok::TOKEN_GNU_KLUDGE",

src/sparse-0.4.4/pre-process.c  view on Meta::CPAN

		break;

	case TOKEN_WIDE_CHAR:
	case TOKEN_WIDE_STRING:
		token_type(left) = res;
		left->pos.noexpand = 0;
		left->string = right->string;
		left->e = e;
		return 1;

	case TOKEN_WIDE_CHAR_EMBEDDED_0 ... TOKEN_WIDE_CHAR_EMBEDDED_3:
		token_type(left) = res;
		left->pos.noexpand = 0;
		memcpy(left->embedded, right->embedded, 4);
		left->e = e;
		return 1;

	default:
		;
	}
	sparse_error(sctx_ left->pos, "'##' failed: concatenation is not a valid token");

src/sparse-0.4.4/pre-process.c  view on Meta::CPAN

		different = strcmp(t1->number, t2->number);
		break;
	case TOKEN_SPECIAL:
		different = t1->special != t2->special;
		break;
	case TOKEN_MACRO_ARGUMENT:
	case TOKEN_QUOTED_ARGUMENT:
	case TOKEN_STR_ARGUMENT:
		different = t1->argnum != t2->argnum;
		break;
	case TOKEN_CHAR_EMBEDDED_0 ... TOKEN_CHAR_EMBEDDED_3:
	case TOKEN_WIDE_CHAR_EMBEDDED_0 ... TOKEN_WIDE_CHAR_EMBEDDED_3:
		different = memcmp(t1->embedded, t2->embedded, 4);
		break;
	case TOKEN_CHAR:
	case TOKEN_WIDE_CHAR:
	case TOKEN_STRING:
	case TOKEN_WIDE_STRING: {
		struct string *s1, *s2;

		s1 = t1->string;
		s2 = t2->string;

src/sparse-0.4.4/token_struct.h  view on Meta::CPAN

	char name[128];		/* Actual identifier */
};

enum token_type {
	TOKEN_EOF,
	TOKEN_ERROR,
	TOKEN_IDENT,
	TOKEN_ZERO_IDENT,
	TOKEN_NUMBER,
	TOKEN_CHAR,
	TOKEN_CHAR_EMBEDDED_0,
	TOKEN_CHAR_EMBEDDED_1,
	TOKEN_CHAR_EMBEDDED_2,
	TOKEN_CHAR_EMBEDDED_3,
	TOKEN_WIDE_CHAR,
	TOKEN_WIDE_CHAR_EMBEDDED_0,
	TOKEN_WIDE_CHAR_EMBEDDED_1,
	TOKEN_WIDE_CHAR_EMBEDDED_2,
	TOKEN_WIDE_CHAR_EMBEDDED_3,
	TOKEN_STRING,
	TOKEN_WIDE_STRING,
	TOKEN_SPECIAL,
	TOKEN_STREAMBEGIN,
	TOKEN_STREAMEND,
	TOKEN_MACRO_ARGUMENT,
	TOKEN_STR_ARGUMENT,
	TOKEN_QUOTED_ARGUMENT,
	TOKEN_CONCAT,
	TOKEN_GNU_KLUDGE,

src/sparse-0.4.4/tokenize.c  view on Meta::CPAN


	case TOKEN_NUMBER:
		return token->number;

	case TOKEN_SPECIAL:
		return show_special(sctx_ token->special);

	case TOKEN_CHAR: 
		return show_char(sctx_ token->string->data,
			token->string->length - 1, 0, '\'');
	case TOKEN_CHAR_EMBEDDED_0 ... TOKEN_CHAR_EMBEDDED_3:
		return show_char(sctx_ token->embedded,
			token_type(token) - TOKEN_CHAR, 0, '\'');
	case TOKEN_WIDE_CHAR: 
		return show_char(sctx_ token->string->data,
			token->string->length - 1, 'L', '\'');
	case TOKEN_WIDE_CHAR_EMBEDDED_0 ... TOKEN_WIDE_CHAR_EMBEDDED_3:
		return show_char(sctx_ token->embedded,
			token_type(token) - TOKEN_WIDE_CHAR, 'L', '\'');
	case TOKEN_STRING: 
		return show_char(sctx_ token->string->data,
			token->string->length - 1, 0, '"');
	case TOKEN_WIDE_STRING: 
		return show_char(sctx_ token->string->data,
			token->string->length - 1, 'L', '"');

	case TOKEN_STREAMBEGIN:

src/sparse-0.4.4/tokenize.c  view on Meta::CPAN


	case TOKEN_NUMBER:
		return token->number;

	case TOKEN_SPECIAL:
		return show_special(sctx_ token->special);

	case TOKEN_CHAR: 
		return quote_char(sctx_ token->string->data,
			token->string->length - 1, 0, '\'');
	case TOKEN_CHAR_EMBEDDED_0 ... TOKEN_CHAR_EMBEDDED_3:
		return quote_char(sctx_ token->embedded,
			token_type(token) - TOKEN_CHAR, 0, '\'');
	case TOKEN_WIDE_CHAR: 
		return quote_char(sctx_ token->string->data,
			token->string->length - 1, 'L', '\'');
	case TOKEN_WIDE_CHAR_EMBEDDED_0 ... TOKEN_WIDE_CHAR_EMBEDDED_3:
		return quote_char(sctx_ token->embedded,
			token_type(token) - TOKEN_WIDE_CHAR, 'L', '\'');
	case TOKEN_STRING: 
		return quote_char(sctx_ token->string->data,
			token->string->length - 1, 0, '"');
	case TOKEN_WIDE_STRING: 
		return quote_char(sctx_ token->string->data,
			token->string->length - 1, 'L', '"');
	default:
		sprintf(buffer, "unhandled token type '%d' ", token_type(token));



( run in 0.868 second using v1.01-cache-2.11-cpan-71847e10f99 )