summaryrefslogtreecommitdiffstats
path: root/Help/prop_tgt/LINK_DEPENDS.rst
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-06-08 21:35:31 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-09 13:16:34 (GMT)
commite9da5192e5bd0c660bfe36fe5bdab57f7b13cdcb (patch)
treee0ce47be17613c2a86734214cb56e06fbd6372ef /Help/prop_tgt/LINK_DEPENDS.rst
parentba92e11f8b461513566d5cc3c0b53b2215bb85f7 (diff)
downloadCMake-e9da5192e5bd0c660bfe36fe5bdab57f7b13cdcb.zip
CMake-e9da5192e5bd0c660bfe36fe5bdab57f7b13cdcb.tar.gz
CMake-e9da5192e5bd0c660bfe36fe5bdab57f7b13cdcb.tar.bz2
CPack/PackageMaker: port to cmXMLWriter
Diffstat (limited to 'Help/prop_tgt/LINK_DEPENDS.rst')
0 files changed, 0 insertions, 0 deletions
/a> 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
/******************************************************************************
 *
 * 
 *
 *
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */

%{

#include "cppvalue.h"
#include "constexp.h"
#include "message.h"

#if defined(_MSC_VER)
#define MSDOS
#endif


#include <stdio.h>
#include <stdlib.h>

int constexpYYerror(yyscan_t yyscanner, const char *s)
{
  struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
  warn(yyextra->g_constExpFileName, yyextra->g_constExpLineNr,
       "preprocessing issue while doing constant expression evaluation: %s",s);
  return 0;
}

%}

%name-prefix "constexpYY"
%define api.pure full
%lex-param {yyscan_t yyscanner}
%parse-param {yyscan_t yyscanner}

%token TOK_QUESTIONMARK
%token TOK_COLON
%token TOK_OR
%token TOK_AND
%token TOK_BITWISEOR
%token TOK_BITWISEXOR
%token TOK_AMPERSAND
%token TOK_NOTEQUAL
%token TOK_EQUAL
%token TOK_LESSTHAN
%token TOK_GREATERTHAN
%token TOK_LESSTHANOREQUALTO
%token TOK_GREATERTHANOREQUALTO
%token TOK_SHIFTLEFT
%token TOK_SHIFTRIGHT
%token TOK_PLUS
%token TOK_MINUS
%token TOK_STAR
%token TOK_DIVIDE
%token TOK_MOD
%token TOK_TILDE
%token TOK_NOT
%token TOK_LPAREN
%token TOK_RPAREN
%token TOK_OCTALINT
%token TOK_DECIMALINT
%token TOK_HEXADECIMALINT
%token TOK_CHARACTER
%token TOK_FLOAT

%%

start: constant_expression
       {
         struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
         yyextra->g_resultValue = $1; return 0;
       }
;

constant_expression: logical_or_expression
                     { $$ = $1; }
	           | logical_or_expression 
                     TOK_QUESTIONMARK logical_or_expression 
                     TOK_COLON logical_or_expression
		     {
		       bool c = ($1.isInt() ? ((long)$1 != 0) : ((double)$1 != 0.0));
		       $$ = c ? $3 : $5;
	             }
;

logical_or_expression: logical_and_expression
		       { $$ = $1; }
                     | logical_or_expression TOK_OR logical_and_expression
		       {
			 $$ = CPPValue( (long)((long)$1 || (long)$3) );
		       }
;

logical_and_expression: inclusive_or_expression
			{ $$ = $1; }
		      | logical_and_expression TOK_AND inclusive_or_expression
			{
			  $$ = CPPValue( (long)((long)$1 && (long)$3) );
			}
;

inclusive_or_expression: exclusive_or_expression
			 { $$ = $1; }
		       | inclusive_or_expression TOK_BITWISEOR 
                         exclusive_or_expression
			 { 
			   $$ = CPPValue( (long)$1 | (long)$3 );
			 }
;

exclusive_or_expression: and_expression
			 { $$ = $1; }
		       | exclusive_or_expression TOK_BITWISEXOR and_expression
			 {
			   $$ = CPPValue( (long)$1 ^ (long)$3 );
			 }
;

and_expression:	equality_expression
		{ $$ = $1; }
	      | and_expression TOK_AMPERSAND equality_expression
		{ 
		  $$ = CPPValue( (long)$1 & (long)$3 );
		}
;

equality_expression: relational_expression
		     { $$ = $1; }
		   | equality_expression TOK_EQUAL relational_expression
		     { 
		       $$ = CPPValue( (long)((double)$1 == (double)$3) );
	             }
		   | equality_expression TOK_NOTEQUAL relational_expression
		     {
                       $$ = CPPValue( (long)((double)$1 != (double)$3) );
		     }
;

relational_expression: shift_expression
		       { $$ = $1; }
		     | relational_expression TOK_LESSTHAN shift_expression
		       { 
			 $$ = CPPValue( (long)((double)$1 < (double)$3) );
		       }
		     | relational_expression TOK_GREATERTHAN shift_expression
		       {
                         $$ = CPPValue( (long)((double)$1 > (double)$3) );
		       }
		     | relational_expression TOK_LESSTHANOREQUALTO
		       shift_expression
		       {
		         $$ = CPPValue( (long)((double)$1 <= (double)$3) );
		       }
		     | relational_expression TOK_GREATERTHANOREQUALTO
		       shift_expression
		       {
			 $$ = CPPValue( (long)((double)$1 >= (double)$3) );
		       }
;

shift_expression: additive_expression
		  { $$ = $1; }
		| shift_expression TOK_SHIFTLEFT additive_expression
		  {
		    $$ = CPPValue( (long)$1 << (long)$3 );	
		  }
		| shift_expression TOK_SHIFTRIGHT additive_expression
		  {
		    $$ = CPPValue( (long)$1 >> (long)$3 );
		  }
;

additive_expression: multiplicative_expression
		     { $$ = $1; }
		   | additive_expression TOK_PLUS multiplicative_expression
		     {
		       if (!$1.isInt() || !$3.isInt())
		       {
		         $$ = CPPValue( (double)$1 + (double)$3 );
		       }
		       else	
		       {
		         $$ = CPPValue( (long)$1 + (long)$3 );
		       }
		     }
		   | additive_expression TOK_MINUS multiplicative_expression
		     {
		       if (!$1.isInt() || !$3.isInt())
		       {
		         $$ = CPPValue( (double)$1 - (double)$3 );
		       }
		       else	
		       {
		         $$ = CPPValue( (long)$1 - (long)$3 );
		       }
		     }
;

multiplicative_expression: unary_expression
			   { $$ = $1; }
			 | multiplicative_expression TOK_STAR unary_expression
			   { 
			     if (!$1.isInt() || !$3.isInt())
			     {
			       $$ = CPPValue( (double)$1 * (double)$3 );
			     }
			     else
			     {
			       $$ = CPPValue( (long)$1 * (long)$3 );
			     }
			   }
			 | multiplicative_expression TOK_DIVIDE unary_expression
			   { 
			     if (!$1.isInt() || !$3.isInt())
			     {
			       $$ = CPPValue( (double)$1 / (double)$3 );
			     }
			     else
			     {
			       long value = $3;
			       if (value==0) value=1;
			       $$ = CPPValue( (long)$1 / value );
			     }
			   }
			 | multiplicative_expression TOK_MOD unary_expression
			   { 
			     long value = $3;
			     if (value==0) value=1;
			     $$ = CPPValue( (long)$1 % value );
			   }
;

unary_expression: primary_expression
		  { $$ = $1; }
	        | TOK_PLUS unary_expression
		  { $$ = $1; }
		| TOK_MINUS unary_expression
		  { 
		    if ($2.isInt()) 
                      $$ = CPPValue(-(long)$2);
                    else
		      $$ = CPPValue(-(double)$2);
		  }
		| TOK_TILDE unary_expression
		  {
		    $$ = CPPValue(~(long)$2);
		  }
		| TOK_NOT unary_expression
		  {
		    $$ = CPPValue((long)!(long)$2);
		  }
;

primary_expression: constant
		    { $$ = $1; }
		  | TOK_LPAREN constant_expression TOK_RPAREN
		    { $$ = $2; }
;

constant: TOK_OCTALINT
	  {
	    struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
	    $$ = parseOctal(yyextra->g_strToken);
	  }
	| TOK_DECIMALINT
	  {
	    struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
	    $$ = parseDecimal(yyextra->g_strToken);
	  }
	| TOK_HEXADECIMALINT
	  {
	    struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
	    $$ = parseHexadecimal(yyextra->g_strToken);
	  }
	| TOK_CHARACTER
	  {
	    struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
	    $$ = parseCharacter(yyextra->g_strToken);
	  }
	| TOK_FLOAT
	  {
	    struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
	    $$ = parseFloat(yyextra->g_strToken);
	  }
;

%%