Skip to content

Commit

Permalink
Change a few options to get c# partially working
Browse files Browse the repository at this point in the history
  • Loading branch information
robertleeplummerjr committed Sep 9, 2013
1 parent c6e8767 commit ee3c5eb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
24 changes: 10 additions & 14 deletions Formula.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Linq;

using Sheet;

namespace Jison
{
Expand Down Expand Up @@ -1873,7 +1873,7 @@ public Formula()

}

public Sheet.Expression ParserPerformAction(ref Sheet.Expression thisS, ref Sheet.Expression yy, ref int yystate, ref JList<Sheet.Expression> ss)
public Expression ParserPerformAction(ref Expression thisS, ref Expression yy, ref int yystate, ref JList<Expression> ss)
{
var so = ss.Count - 1;
/* this == yyval */
Expand Down Expand Up @@ -1973,17 +1973,13 @@ public Sheet.Expression ParserPerformAction(ref Sheet.Expression thisS, ref Shee

break;
case 13:
thisS = (ss[so-3]) != (ss[so]);


ss[so-3].Set(ss[so-3].Text != ss[so].Text);
thisS = ss[so-3];


break;
case 14:
thisS = ss[so-2] != ss[so];


ss[so-2].Set(ss[so-2].Text != ss[so].Text);
thisS = ss[so-2];
Expand Down Expand Up @@ -2240,7 +2236,7 @@ public void LexerError(string error, LexerError hash = null)
throw new InvalidOperationException(error);
}

public Sheet.Expression Parse(string input)
public Expression Parse(string input)
{
if (Table == null) {
throw new Exception("Empty table");
Expand All @@ -2249,13 +2245,13 @@ public Sheet.Expression Parse(string input)
{
new ParserCachedAction(new ParserAction(0, Table[0]))
};
var vstack = new JList<Sheet.Expression>
var vstack = new JList<Expression>
{
new Sheet.Expression()
new Expression()
};
var yy = new Sheet.Expression();
var _yy = new Sheet.Expression();
var v = new Sheet.Expression();
var yy = new Expression();
var _yy = new Expression();
var v = new Expression();
int recovering = 0;
ParserSymbol symbol = null;
ParserAction action = null;
Expand Down Expand Up @@ -2369,7 +2365,7 @@ public Sheet.Expression Parse(string input)

if (_yy == null)
{
vstack.Push(new Sheet.Expression());
vstack.Push(new Expression());
}
else
{
Expand All @@ -2393,7 +2389,7 @@ public Sheet.Expression Parse(string input)

/* Jison generated lexer */
public ParserSymbol Eof = new ParserSymbol("Eof", 1);
public Sheet.Expression Yy = new Sheet.Expression();
public Expression Yy = new Expression();
public string Match = "";
public string Matched = "";
public Stack<string> ConditionStack;
Expand Down
9 changes: 6 additions & 3 deletions formula.jison
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//option class:Formula
//option parserValue:Sheet.Expression
//option parserValue:Expression
//option using:Sheet
/* description: Parses end evaluates mathematical expressions. */
/* lexical grammar */
%lex
Expand Down Expand Up @@ -240,7 +241,8 @@ expression
*/
}
| expression '<' '>' expression {
$$ = ($1) != ($4);
//js|php
$$ = ($1) != ($4);
//js
if (isNaN($$)) {
Expand All @@ -253,7 +255,8 @@ expression
*/
}
| expression NOT expression {
$$ = $1 != $3;
//js|php
$$ = $1 != $3;
/*cs
$1.Set($1.Text != $3.Text);
Expand Down
6 changes: 4 additions & 2 deletions formula.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions formula.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@



class formula
class Formula
{
public $symbols = array();
public $terminals = array();
Expand Down Expand Up @@ -1997,14 +1997,10 @@ function parserPerformAction(&$thisS, &$yy, $yystate, &$s, $o)

break;
case 13:
$thisS = ($s[$o-3]) != ($s[$o]);



break;
case 14:
$thisS = $s[$o-2] != $s[$o];



break;
Expand Down Expand Up @@ -2348,7 +2344,7 @@ function parse($input)

if (is_null($_yy))
{
$vstack[] = new ParserValue();
$vstack[] = new Expression();
}
else
{
Expand Down Expand Up @@ -2398,7 +2394,7 @@ function setInput($input)
{
$this->input = $input;
$this->more = $this->less = $this->done = false;
$this->yy = new ParserValue();
$this->yy = new Expression();
$this->conditionStack = array('INITIAL');
$this->conditionStackCount = 1;

Expand Down

0 comments on commit ee3c5eb

Please sign in to comment.