Compare commits

..

No commits in common. "14c0cb2760cf73ea0f25f00dae725bd7836c3d16" and "2d7a7491fa7b9453acff00f48062b8568792b193" have entirely different histories.

2 changed files with 37 additions and 7 deletions

View File

@ -56,11 +56,6 @@ example as invalid: it misleads what the result of the operation is.
This change is consistent with what is written in the SCU manual This change is consistent with what is written in the SCU manual
(ST-97-R5-072694), but is inconsistent with SEGA's SCU DSP examples. (ST-97-R5-072694), but is inconsistent with SEGA's SCU DSP examples.
.. note::
It is currently unclear which of the two is correct. A future
version of scu-dsp-asm may change this behavior.
Differences that affect code generation Differences that affect code generation
======================================= =======================================
@ -90,8 +85,8 @@ In short:
Spurious invalid X-bus opcode generation Spurious invalid X-bus opcode generation
---------------------------------------- ----------------------------------------
Under seemingly-random circumstances, ``dspasm.exe`` emits the Under seemly-random circumstances, ``dspasm.exe`` emits the undefined
undefined X-bus opcode ``001``. Given: X-bus opcode ``001``. Given:
.. code:: .. code::

35
lexer_iterator.cpp Normal file
View File

@ -0,0 +1,35 @@
#include "lexer.hpp"
#include "token.hpp"
namespace dsp {
struct lexer_iterator_t
{
token_t previous_token;
token_t current_token;
lexer_t& lexer;
lexer_iterator_t(lexer_t& lexer)
: lexer(lexer), previous_token(lexer.scan_token()), current_token(previous_token)
{
}
token_t& advance()
{
previous_token = current_token;
current_token = lexer.scan_token();
return previous_token;
}
token_t& peek()
{
return current_token;
}
token_t& previous()
{
return previous_token;
}
};
}