On Sun, Oct 26, 2008 at 8:41 AM, Ruini Xue <xueruini@gmail.com> wrote:
luigi scarso <luigi.scarso <at> gmail.com> writes:

>
>
> On Sat, Oct 25, 2008 at 6:12 PM, Ruini Xue <xueruini <at> gmail.com> wrote:
> source file:
>
> Watch for the space after knuth
> {\input knuth\relax}
>
Also this works
%%%%%%%%%%%%%%
\starttext
\begingroup\input knuth\endgroup

\stoptext
%%%%%%%%%%%%%%%%%%%


and  this doesn't work
%%%%%%%%%%%%%%
\starttext
\bgroup\input knuth\egroup

\stoptext
%%%%%%%%%%%%%%%%%%%



 

I just want to know why \input includes the right brace "}" in the file name.

\input is a primitive of LuaTeX;
give a look at luatex.pdf
to see how it's implemented .
Here some web code (look at name_in_progress ) :

378. The processing of \input involves the start input subroutine, which will be declared later; the
processing of \endinput is trivial.
< Put each of TEX's primitives into the hash table 241 >+=
  primitive ("input", input , 0);
  primitive ("endinput", input , 1);
379.   <   Cases of print cmd chr for symbolic printing of primitives 242 >+=
input : if chr code = 0 then print esc ("input")
< Cases of input for print cmd chr 1529>
else print esc ("endinput");


380.     Initiate or terminate input from a file 380
  if cur chr = 1 then force eof  true
  <  Cases for input 1530>
else if name in progress then insert relax
  else start input
This code is used in section 368.

381. Sometimes the expansion looks too far ahead, so we want to insert a harmless \relax into the user's
input.
< Declare the procedure called insert relax 381 > +=
procedure insert relax ;
  begin cur tok  cs token flag + cur cs ; back input ; cur tok  cs token flag + frozen relax ; back input ;
  token type  inserted ;
  end;
This code is used in section 365.


536* Now let's consider the driver routines by which TEX deals with file names in a system-independent.
manner. First comes a procedure that looks for a file name in the input by calling get x token for the
information.
procedure scan file name ;
   label done ;
   begin name in progress  true ; begin name ; Get the next non-blank non-call token 410 ;
   loop begin if (cur cmd > other char )  (cur chr > biggest char ) then { not a character }
         begin back input ; goto done ;
         end; { If cur chr is a space and we're not scanning a token list, check whether we're at the end of
             the buffer. Otherwise we end up adding spurious spaces to file names in some cases. }
      if (cur chr = " ")  (state = token list )  (loc > limit ) then goto done ;
      if ¬more name (cur chr ) then goto done ;
      get x token ;
      end;
done : end name ; name in progress  false ;
   end;


537. The global variable name in progress is used to prevent recursive use of scan file name , since the
begin name and other procedures communicate via global variables. Recursion would arise only by devious
tricks like `\input\input f'; such attempts at sabotage must be thwarted. Furthermore, name in progress
prevents \input from being initiated when a font size specification is being scanned.
   Another global variable, job name , contains the file name that was first \input by the user. This name
is extended by `.log' and `.dvi' and `.fmt' in the names of TEX's output files.
  Global variables 13 +
name in progress : boolean ; { is a file name being scanned? }
job name : str number ; { principal file name }
log opened : boolean ; { has the transcript file been opened? }




 

-- ruini




___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________



--
luigi