1494N/A/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
1494N/A
1494N/A/*
1494N/A * This file is part of The Croco Library
1494N/A *
1494N/A * This program is free software; you can redistribute it and/or
1494N/A * modify it under the terms of version 2.1 of the GNU Lesser General Public
1494N/A * License as published by the Free Software Foundation.
1494N/A *
1494N/A * This program is distributed in the hope that it will be useful,
1494N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
1494N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1494N/A * GNU General Public License for more details.
1494N/A *
1494N/A * You should have received a copy of the GNU Lesser General Public License
1494N/A * along with this program; if not, write to the Free Software
1494N/A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
1494N/A * USA
1494N/A *
1494N/A * Author: Dodji Seketeli
1494N/A * See COPYRIGHTS file for copyright information.
1494N/A */
1494N/A
1494N/A#ifndef __CR_TOKEN_H__
1494N/A#define __CR_TOKEN_H__
1494N/A
1494N/A#include "cr-utils.h"
1494N/A#include "cr-input.h"
1494N/A#include "cr-num.h"
1494N/A#include "cr-rgb.h"
1494N/A#include "cr-string.h"
1494N/A#include "cr-parsing-location.h"
1494N/A
1494N/AG_BEGIN_DECLS
1494N/A
1494N/Aenum CRTokenType
1494N/A{
1494N/A NO_TK,
1494N/A S_TK,
1494N/A CDO_TK,
1494N/A CDC_TK,
1494N/A INCLUDES_TK,
1494N/A DASHMATCH_TK,
1494N/A COMMENT_TK,
1494N/A STRING_TK,
1494N/A IDENT_TK,
1494N/A HASH_TK,
1494N/A IMPORT_SYM_TK,
1494N/A PAGE_SYM_TK,
1494N/A MEDIA_SYM_TK,
1494N/A FONT_FACE_SYM_TK,
1494N/A CHARSET_SYM_TK,
1494N/A ATKEYWORD_TK,
1494N/A IMPORTANT_SYM_TK,
1494N/A EMS_TK,
1494N/A EXS_TK,
1494N/A LENGTH_TK,
1494N/A ANGLE_TK,
1494N/A TIME_TK,
1494N/A FREQ_TK,
1494N/A DIMEN_TK,
1494N/A PERCENTAGE_TK,
1494N/A NUMBER_TK,
1494N/A RGB_TK,
1494N/A URI_TK,
1494N/A FUNCTION_TK,
1494N/A UNICODERANGE_TK,
1494N/A SEMICOLON_TK,
1494N/A CBO_TK, /*opening curly bracket*/
1494N/A CBC_TK, /*closing curly bracket*/
1494N/A PO_TK, /*opening parenthesis*/
1494N/A PC_TK, /*closing parenthesis*/
1494N/A BO_TK, /*opening bracket*/
1494N/A BC_TK, /*closing bracket*/
1494N/A DELIM_TK
1494N/A} ;
1494N/A
1494N/Aenum CRTokenExtraType
1494N/A{
1494N/A NO_ET = 0,
1494N/A LENGTH_PX_ET,
1494N/A LENGTH_CM_ET,
1494N/A LENGTH_MM_ET,
1494N/A LENGTH_IN_ET,
1494N/A LENGTH_PT_ET,
1494N/A LENGTH_PC_ET,
1494N/A ANGLE_DEG_ET,
1494N/A ANGLE_RAD_ET,
1494N/A ANGLE_GRAD_ET,
1494N/A TIME_MS_ET,
1494N/A TIME_S_ET,
1494N/A FREQ_HZ_ET,
1494N/A FREQ_KHZ_ET
1494N/A} ;
1494N/A
1494N/Atypedef struct _CRToken CRToken ;
1494N/A
1494N/A/**
1494N/A *This class abstracts a css2 token.
1494N/A */
1494N/Astruct _CRToken
1494N/A{
1494N/A enum CRTokenType type ;
1494N/A enum CRTokenExtraType extra_type ;
1494N/A CRInputPos pos ;
1494N/A
1494N/A union
1494N/A {
1494N/A CRString *str ;
1494N/A CRRgb *rgb ;
1494N/A CRNum *num ;
1494N/A guint32 unichar ;
1494N/A } u ;
1494N/A
1494N/A CRString * dimen ;
1494N/A CRParsingLocation location ;
1494N/A} ;
1494N/A
CRToken* cr_token_new (void) ;
enum CRStatus cr_token_set_s (CRToken *a_this) ;
enum CRStatus cr_token_set_cdo (CRToken *a_this) ;
enum CRStatus cr_token_set_cdc (CRToken *a_this) ;
enum CRStatus cr_token_set_includes (CRToken *a_this) ;
enum CRStatus cr_token_set_dashmatch (CRToken *a_this) ;
enum CRStatus cr_token_set_comment (CRToken *a_this, CRString *a_str) ;
enum CRStatus cr_token_set_string (CRToken *a_this, CRString *a_str) ;
enum CRStatus cr_token_set_ident (CRToken *a_this, CRString * a_ident) ;
enum CRStatus cr_token_set_hash (CRToken *a_this, CRString *a_hash) ;
enum CRStatus cr_token_set_rgb (CRToken *a_this, CRRgb *a_rgb) ;
enum CRStatus cr_token_set_import_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_page_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_media_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_font_face_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_charset_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_atkeyword (CRToken *a_this, CRString *a_atname) ;
enum CRStatus cr_token_set_important_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_ems (CRToken *a_this, CRNum *a_num) ;
enum CRStatus cr_token_set_exs (CRToken *a_this, CRNum *a_num) ;
enum CRStatus cr_token_set_length (CRToken *a_this, CRNum *a_num,
enum CRTokenExtraType a_et) ;
enum CRStatus cr_token_set_angle (CRToken *a_this, CRNum *a_num,
enum CRTokenExtraType a_et) ;
enum CRStatus cr_token_set_time (CRToken *a_this, CRNum *a_num,
enum CRTokenExtraType a_et) ;
enum CRStatus cr_token_set_freq (CRToken *a_this, CRNum *a_num,
enum CRTokenExtraType a_et) ;
enum CRStatus cr_token_set_dimen (CRToken *a_this, CRNum *a_num,
CRString *a_dim) ;
enum CRStatus cr_token_set_percentage (CRToken *a_this, CRNum *a_num) ;
enum CRStatus cr_token_set_number (CRToken *a_this, CRNum *a_num) ;
enum CRStatus cr_token_set_uri (CRToken *a_this, CRString *a_uri) ;
enum CRStatus cr_token_set_function (CRToken *a_this,
CRString *a_fun_name) ;
enum CRStatus cr_token_set_bc (CRToken *a_this) ;
enum CRStatus cr_token_set_bo (CRToken *a_this) ;
enum CRStatus cr_token_set_po (CRToken *a_this) ;
enum CRStatus cr_token_set_pc (CRToken *a_this) ;
enum CRStatus cr_token_set_cbc (CRToken *a_this) ;
enum CRStatus cr_token_set_cbo (CRToken *a_this) ;
enum CRStatus cr_token_set_semicolon (CRToken *a_this) ;
enum CRStatus cr_token_set_delim (CRToken *a_this, guint32 a_char) ;
/*
enum CRStatus
cr_token_set_unicoderange (CRToken *a_this,
CRUnicodeRange *a_range) ;
*/
void
cr_token_destroy (CRToken *a_this) ;
G_END_DECLS
#endif /*__CR_TOKEN_H__*/