This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch ( yy_act ) | |
{ /* beginning of action switch */ | |
case 0: /* must back up */ | |
/* undo the effects of YY_DO_BEFORE_ACTION */ | |
*yy_cp = (yy_hold_char); | |
yy_cp = (yy_last_accepting_cpos); | |
yy_current_state = (yy_last_accepting_state); | |
goto yy_find_action; | |
case 1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%option noyywrap | |
%{ | |
/* Lexer example using a overdone c++ class for managing both tokens and logic */ | |
#include "1_simple_calculator.cpp" | |
using namespace simple_calculator; | |
Queue token_queue; | |
Token token; | |
%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flex -o 0_repeater.c 0_repeater.lex # makes an output file tokens.c from tokens.lex | |
# running the generated C source to make a binary | |
gcc 0_repeater.c -lfl -o 0_repeater | |
# or alternately with clang | |
clang 0_repeater.c -lfl -o 0_repeater | |
./repeater # runs the binary, will take input from the command line and run it against the code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
You can add include and setup C code | |
that will go directly into the resulting source code. | |
The format for getting it in their via the Flex DSL is like so: | |
*/ | |
%{ | |
/* this goes straight into the source code! */ | |
#include 'my_file.c' | |
double total = 0.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='header line'> | |
<div class='inner'> | |
<img class='logo unit size1of3' src='/my_logo.png'> | |
<ul class='unit size2of3'> | |
<li> | |
<a href='/login'>Login</a> | |
</li> | |
<li> | |
<a href='/signup'>Sign up</a> | |
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='header'> | |
<img class='logo' src='/my_logo.png'> | |
<ul> | |
<li> | |
<a href='/login'>Login</a> | |
</li> | |
<li> | |
<a href='/signup'>Sign up</a> | |
</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Available operators for overloading criteria interactions | |
# + & | < > <= >= =~ == <=> | |
# criteria creator for matching a hash/array value at a particular location | |
# good for hash/array objects or their derivatives | |
Klass.query do |obj| | |
obj[3] == "something" | | |
obj[:key] == "value" | |
# obj.has_value(my_value, :at => :key) | |
# has_value is alt syntax, could include options for :key/:index to specify hash or array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Possible AQUA query syntax ... | |
# INSTANCE VARIABLES | |
# checks to see if a value exists, works for hashes and for arrays | |
@instance.has_value( value ) # value is a value or array of values | |
#checks to see if a value exists at a certain location | |
@instance.has_value( value, :at => 0 ) # if integer, assumed to be an integer | |
@instance.has_value( value, :at => :first ) # could be either an array or a hash key | |
@instance.has_value( value, :at => :some_key ) # a hash key |