flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Heap > Question about Fasm G User manual

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 89
Location: Russian Federation, Sochi

Question about Fasm G User manual

Tomasz, is "\" a token or not?


Code:
eval 'display ''\'
"80"




Code:
        eval 'display ''\'
eval [1]:
        display \
        
Processeddisplay 
Errorinvalid expression.



According to documentation expression is valid and should be taken from next line.

So, 4 cases:
1. wrong in documentation and "\" as ";" must be not in list of special symbols +-/*=<>()[]{}:?!,.|&~#`\
2. there is a bug in fasmg itself contrary to the documentation

3. my example is bad and "\" work with eval in different example.
4. there is another way to include to source line symbo."\" after end of parsing stage?

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 29 Jun 2017, 14:05
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6685
Location: Kraków, Poland

Concerning documentation: the use of quotes disables tokenization for the contents of the string, the entire quoted string is always a single token. So even though backslash usually is a standalone token, it is not when it occurs inside a quoted string.

As for your actual problem: the arguments to EVAL define a string and only then this string is evaluated. The "\" can be a part of this string and then the line concatenation occurs within the data contained in it:

Code:
eval 'display ''\'1310"80"

You can use some concatenation macros to create long, multi-line strings for EVAL.
Post 29 Jun 2017, 14:13
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 89
Location: Russian Federation, Sochi

entry conditions:
Source code - minimal strict form of program that consist of only a sequences of tokens, where each token and sequence separated from each other with single separator symbol (for ex. whitespace and/or CRLF).
Source text - decorated form of program that allows comments,indentation (and so on...) to improve human readability.
Any character is perceived as a token if it can cross parsing stage from source text to source code and become part of source code, and than can be cathed with match directive as standalone one.

demonstration:
source:

Code:
A 0,\\; first one "\" is inline token, last one "\" is not a token is just a line appender symbol
db 0x0
macro A args&
  local params
  define params args:
  while 1
    match head body,params
      display `head,13,10
      match :,body
        break
      else
        redefine params body
      end match
    end match
  end while
end macro


output:

Code:
flat assembler  version g.hth67
0
,
\
db
0x0

2 passes0 bytes.


Proved:symbol "\" is trully token.

By the way, why behavior of "\" is so that only last "\" is line appender symbol? Why its behavior not like ";" with erasing all text in line that follows that symbol? What for symbol "\" is stayed as token?
Post 03 Jul 2017, 09:22
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6685
Location: Kraków, Poland


ProMiNick wrote:
By the way, why behavior of "\" is so that only last "\" is line appender symbol? Why its behavior not like ";" with erasing all text in line that follows that symbol? What for symbol "\" is stayed as token?

The "\" in a middle of a line is left available for other uses (you can MATCH it, so you can use is for your own syntax when needed). Note that in fasm 1 it had other uses natively (as symbol escaping).
Post 03 Jul 2017, 10:24
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.