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.  * display:CSS_PROP_DISPLAY IDENT:( INHERIT: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE 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 display
  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.  * \return CSS_OK on success,
  29.  *         CSS_NOMEM on memory exhaustion,
  30.  *         CSS_INVALID if the input is not valid
  31.  *
  32.  * Post condition: \a *ctx is updated with the next token to process
  33.  *                 If the input is invalid, then \a *ctx remains unchanged.
  34.  */
  35. css_error css__parse_display(css_language *c,
  36.                 const parserutils_vector *vector, int *ctx,
  37.                 css_style *result)
  38. {
  39.         int orig_ctx = *ctx;
  40.         css_error error;
  41.         const css_token *token;
  42.         bool match;
  43.  
  44.         token = parserutils_vector_iterate(vector, ctx);
  45.         if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT))) {
  46.                 *ctx = orig_ctx;
  47.                 return CSS_INVALID;
  48.         }
  49.  
  50.         if ((lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) {
  51.                         error = css_stylesheet_style_inherit(result, CSS_PROP_DISPLAY);
  52.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[INLINE], &match) == lwc_error_ok && match)) {
  53.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_INLINE);
  54.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[BLOCK], &match) == lwc_error_ok && match)) {
  55.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_BLOCK);
  56.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[LIST_ITEM], &match) == lwc_error_ok && match)) {
  57.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_LIST_ITEM);
  58.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[RUN_IN], &match) == lwc_error_ok && match)) {
  59.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_RUN_IN);
  60.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[INLINE_BLOCK], &match) == lwc_error_ok && match)) {
  61.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_INLINE_BLOCK);
  62.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE], &match) == lwc_error_ok && match)) {
  63.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE);
  64.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[INLINE_TABLE], &match) == lwc_error_ok && match)) {
  65.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_INLINE_TABLE);
  66.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE_ROW_GROUP], &match) == lwc_error_ok && match)) {
  67.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE_ROW_GROUP);
  68.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE_HEADER_GROUP], &match) == lwc_error_ok && match)) {
  69.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE_HEADER_GROUP);
  70.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE_FOOTER_GROUP], &match) == lwc_error_ok && match)) {
  71.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE_FOOTER_GROUP);
  72.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE_ROW], &match) == lwc_error_ok && match)) {
  73.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE_ROW);
  74.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE_COLUMN_GROUP], &match) == lwc_error_ok && match)) {
  75.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE_COLUMN_GROUP);
  76.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE_COLUMN], &match) == lwc_error_ok && match)) {
  77.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE_COLUMN);
  78.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE_CELL], &match) == lwc_error_ok && match)) {
  79.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE_CELL);
  80.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[TABLE_CAPTION], &match) == lwc_error_ok && match)) {
  81.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_TABLE_CAPTION);
  82.         } else if ((lwc_string_caseless_isequal(token->idata, c->strings[NONE], &match) == lwc_error_ok && match)) {
  83.                         error = css__stylesheet_style_appendOPV(result, CSS_PROP_DISPLAY, 0,DISPLAY_NONE);
  84.         } else {
  85.                 error = CSS_INVALID;
  86.         }
  87.  
  88.         if (error != CSS_OK)
  89.                 *ctx = orig_ctx;
  90.        
  91.         return error;
  92. }
  93.  
  94.