Where does nom's “$i” macro argument come from? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Casting pthread's start_routine argument with a macroOverloading Macro on Number of ArgumentsHow to implement a macro system into my LISPUnderstanding DEFER and OBSTRUCT macrosMacro call vs macro definition environment in JuliaStrange definitions of TRUE and FALSE macrosFixing “no rules expected the token” macro errorWhy does avr-gcc tell me about missing argument while expanding my [fancy] macro?How to use a type (ty) within a macro to construct a struct instance in Rust?PHP Internals: How does TSRMLS_FETCH Work?

What is the ongoing value of the Kanban board to the developers as opposed to management

Is Diceware more secure than a long passphrase?

"Rubric" as meaning "signature" or "personal mark" -- is this accepted usage?

What to do with someone that cheated their way through university and a PhD program?

Why does the Cisco show run command not show the full version, while the show version command does?

Check if a string is entirely made of the same substring

Passing args from the bash script to the function in the script

Flash for group photos near wall

Retract an already submitted recommendation letter (written for an undergrad student)

c++ diamond problem - How to call base method only once

How long after the last departure shall the airport stay open for an emergency return?

Where did Arya get these scars?

PIC mathematical operations weird problem

Is Electric Central Heating worth it if using Solar Panels?

Seek and ye shall find

Married in secret, can marital status in passport be changed at a later date?

Why did C use the -> operator instead of reusing the . operator?

Can you stand up from being prone using Skirmisher outside of your turn?

How to count in linear time worst-case?

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

What is it called when you ride around on your front wheel?

Trumpet valves, lengths, and pitch

What is the term for a person whose job is to place products on shelves in stores?

What is this word supposed to be?



Where does nom's “$i” macro argument come from?



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Casting pthread's start_routine argument with a macroOverloading Macro on Number of ArgumentsHow to implement a macro system into my LISPUnderstanding DEFER and OBSTRUCT macrosMacro call vs macro definition environment in JuliaStrange definitions of TRUE and FALSE macrosFixing “no rules expected the token” macro errorWhy does avr-gcc tell me about missing argument while expanding my [fancy] macro?How to use a type (ty) within a macro to construct a struct instance in Rust?PHP Internals: How does TSRMLS_FETCH Work?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








5















I'm trying to understand how Rust macro captures work and am looking at the nom parser library.



Location nom/src/bytes.rs declares macro tag! which captures with ($i:expr, $tag: expr).
However throughout the places where tag! is used it is used with only one argument, i.e. tag!("+").
Example: nom-lua52/op.rs. I've read tutorials about macros however this construct seems to be special.



It seems like the input $i is somehow implicit?










share|improve this question






























    5















    I'm trying to understand how Rust macro captures work and am looking at the nom parser library.



    Location nom/src/bytes.rs declares macro tag! which captures with ($i:expr, $tag: expr).
    However throughout the places where tag! is used it is used with only one argument, i.e. tag!("+").
    Example: nom-lua52/op.rs. I've read tutorials about macros however this construct seems to be special.



    It seems like the input $i is somehow implicit?










    share|improve this question


























      5












      5








      5








      I'm trying to understand how Rust macro captures work and am looking at the nom parser library.



      Location nom/src/bytes.rs declares macro tag! which captures with ($i:expr, $tag: expr).
      However throughout the places where tag! is used it is used with only one argument, i.e. tag!("+").
      Example: nom-lua52/op.rs. I've read tutorials about macros however this construct seems to be special.



      It seems like the input $i is somehow implicit?










      share|improve this question
















      I'm trying to understand how Rust macro captures work and am looking at the nom parser library.



      Location nom/src/bytes.rs declares macro tag! which captures with ($i:expr, $tag: expr).
      However throughout the places where tag! is used it is used with only one argument, i.e. tag!("+").
      Example: nom-lua52/op.rs. I've read tutorials about macros however this construct seems to be special.



      It seems like the input $i is somehow implicit?







      macros rust nom






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 16:22









      loganfsmyth

      107k21229188




      107k21229188










      asked Jul 16 '18 at 18:08









      Konrad EiseleKonrad Eisele

      1,058816




      1,058816






















          1 Answer
          1






          active

          oldest

          votes


















          6














          The trick is that the tag!() macro call is inside the value! macro, which will match against tag! and pass it an additional parameter. This is described in the file implementing tag!.






          share|improve this answer


















          • 1





            Thanks, Now I see the trick: $submac!($i, $($args)*).

            – Konrad Eisele
            Jul 16 '18 at 18:28











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51367781%2fwhere-does-noms-i-macro-argument-come-from%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          6














          The trick is that the tag!() macro call is inside the value! macro, which will match against tag! and pass it an additional parameter. This is described in the file implementing tag!.






          share|improve this answer


















          • 1





            Thanks, Now I see the trick: $submac!($i, $($args)*).

            – Konrad Eisele
            Jul 16 '18 at 18:28















          6














          The trick is that the tag!() macro call is inside the value! macro, which will match against tag! and pass it an additional parameter. This is described in the file implementing tag!.






          share|improve this answer


















          • 1





            Thanks, Now I see the trick: $submac!($i, $($args)*).

            – Konrad Eisele
            Jul 16 '18 at 18:28













          6












          6








          6







          The trick is that the tag!() macro call is inside the value! macro, which will match against tag! and pass it an additional parameter. This is described in the file implementing tag!.






          share|improve this answer













          The trick is that the tag!() macro call is inside the value! macro, which will match against tag! and pass it an additional parameter. This is described in the file implementing tag!.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 16 '18 at 18:24









          starbluestarblue

          45.7k1178138




          45.7k1178138







          • 1





            Thanks, Now I see the trick: $submac!($i, $($args)*).

            – Konrad Eisele
            Jul 16 '18 at 18:28












          • 1





            Thanks, Now I see the trick: $submac!($i, $($args)*).

            – Konrad Eisele
            Jul 16 '18 at 18:28







          1




          1





          Thanks, Now I see the trick: $submac!($i, $($args)*).

          – Konrad Eisele
          Jul 16 '18 at 18:28





          Thanks, Now I see the trick: $submac!($i, $($args)*).

          – Konrad Eisele
          Jul 16 '18 at 18:28



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51367781%2fwhere-does-noms-i-macro-argument-come-from%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해