Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file was generated by LibCSS gen_parser
  3.  *
  4.  * Generated from:
  5.  *
  6.  * border_side_style:op GENERIC: IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:)
  7.  *
  8.  * Licensed under the MIT License,
  9.  *                http://www.opensource.org/licenses/mit-license.php
  10.  * Copyright 2010 The NetSurf Browser Project.
  11.  */
  12.  
  13. #include <assert.h>
  14. #include <string.h>
  15.  
  16. #include "bytecode/bytecode.h"
  17. #include "bytecode/opcodes.h"
  18. #include "parse/properties/properties.h"
  19. #include "parse/properties/utils.h"
  20.  
  21. /**
  22.  * Parse border_side_style
  23.  *
  24.  * \param c       Parsing context
  25.  * \param vector  Vector of tokens to process
  26.  * \param ctx     Pointer to vector iteration context
  27.  * \param result  resulting style
  28.  * \param op     Bytecode OpCode for CSS property to encode
  29.  * \return CSS_OK on success,
  30.  *         CSS_NOMEM on memory exhaustion,
  31.  *         CSS_INVALID if the input is not valid
  32.  *
  33.  * Post condition: \a *ctx is updated with the next token to process
  34.  *                 If the input is invalid, then \a *ctx remains unchanged.
  35.  */
  36. css_error css__parse_border_side_style(css_language *c,
  37.                 const parserutils_vector *vector, int *ctx,
  38.                 css_style *result, enum css_properties_e op)
  39. {
  40.         int orig_ctx = *ctx;
  41.         css_error error;
  42.         const css_token *token;
  43.         bool match;
  44.  
  45.         token = parserutils_vector_iterate(vector, ctx);
  46.         if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT))) {
  47.                 *ctx = orig_ctx;
  48.                 return CSS_INVALID;
  49.         }
  50.  
  51.         if ((lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) {
  52.                         error = css_stylesheet_style_inherit(result, op);
  53.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[NONE], &match) == lwc_error_ok && match)) {
  54.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_NONE);
  55.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[HIDDEN], &match) == lwc_error_ok && match)) {
  56.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_HIDDEN);
  57.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[DOTTED], &match) == lwc_error_ok && match)) {
  58.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_DOTTED);
  59.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[DASHED], &match) == lwc_error_ok && match)) {
  60.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_DASHED);
  61.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[SOLID], &match) == lwc_error_ok && match)) {
  62.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_SOLID);
  63.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[LIBCSS_DOUBLE], &match) == lwc_error_ok && match)) {
  64.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_DOUBLE);
  65.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[GROOVE], &match) == lwc_error_ok && match)) {
  66.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_GROOVE);
  67.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[RIDGE], &match) == lwc_error_ok && match)) {
  68.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_RIDGE);
  69.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[INSET], &match) == lwc_error_ok && match)) {
  70.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_INSET);
  71.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[OUTSET], &match) == lwc_error_ok && match)) {
  72.                         error = css__stylesheet_style_appendOPV(result, op, 0,BORDER_STYLE_OUTSET);
  73.         } else {
  74.                 error = CSS_INVALID;
  75.         }
  76.  
  77.         if (error != CSS_OK)
  78.                 *ctx = orig_ctx;
  79.        
  80.         return error;
  81. }
  82.  
  83.