Which source file contains the lexer (scanner) for make file?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Which source file contains the lexer (scanner) for make file?
Like Python, 'make' files need indentation.
'make' needs that the indented line be spaced by a tab, and putting instead spaces (for getting the same number of spaces, as a tab) wouldn't work.
I assume that this task of checking if a tab is there before any indented line, is done by the scanner (lexer/lexical analyzer) for the 'make' utility.
Please tell where to locate the same in the source code of the make utility.
Am working in cygwin, but assume that the path of the file would be the same as in Linux.
no, that is not indentation, but anyway if you wish you can call it indentation. The tab (one tab character) at the beginning of the lines is a requirement, otherwise the indentation (or spacing) is irrelevant.
It is explained here: https://www.gnu.org/software/make/ma...le-Syntax.html
no, that is not indentation, but anyway if you wish you can call it indentation. The tab (one tab character) at the beginning of the lines is a requirement, otherwise the indentation (or spacing) is irrelevant.
It is explained here: https://www.gnu.org/software/make/ma...le-Syntax.html
Thanks, but still till line #1340, am still trying to find the closing that started at the line #570.
Please tell why the line #1008 (&, at line #1162), starts with an opening brace, when there is no function's start for the same.
It seems like a scope, which have forgotten; i.e. one without a function definition.
P.S.: Also, seems the code block ends at the line #1982, as by putting in VS, could see the ending of the opening brace there.
So, if am correct, it is a 1412 lines of code block.
P.S.(1) : Might be am wrong, as seems the end of the block is further down. Please indicate, where the end lies, as difficult to check just by using VS editor.
Thanks, but still till line #1340, am still trying to find the closing that started at the line #570.
Please tell why the line #1008 (&, at line #1162), starts with an opening brace, when there is no function's start for the same.
It seems like a scope, which have forgotten; i.e. one without a function definition.
Good old Vim says that block runs from #570 to #1359.
The block from #1008 to #1346 is for scope (see comment preceeding it).
Last edited by astrogeek; 02-04-2024 at 12:08 PM.
Reason: Add relevant quote
Good old Vim says that block runs from #570 to #1359.
The block from #1008 to #1346 is for scope (see comment preceeding it).
Yes, that is the answer. scope means variables defined inside { } do not exist outside, they are local to that scope. You can find it everywhere, within if, else, for, while and other statements, and you can also use it alone (see line 784 too).
Good old Vim says that block runs from #570 to #1359.
The block from #1008 to #1346 is for scope (see comment preceeding it).
Request a tool that helps find the (matching) ending parenthesis, as don't think vim helps in that.
Even VS seems to not help, as easily got confused by that to go much further (i.e., till the line #1982), than the end of the block stated by you.
Have read something here, that states to make own lexer, for the makefiles, in the response by @gstavi; but couldn't make much sense out of it.
Anyway, am amazed how you found out so quickly, as where the code block correctly ends.
Tried WSL for running ubuntu on windows.
But, still didn't help though vim works.
The result is attached herewith (though am suggested here to not attach), in order to ask for help; which feel is lesser than what is needed by me.
I don't understand. Can't you just press the % key?
Please, if possible, show what the pressing the % key achieves, as for me makes no show of matching parenthesis.
Am also confused as why nowhere (book, webpage, youtube) is shown the 'actual' effect of pressing %; at least a video could have shown it.
I tried many times, by placing the cursor at the line #571, & pressing % key; but failed to see what happens. Just the cursor disappears, but how to go down so much below is really an issue; that too by pressing the 'down' key!
Wish if you could please show what it achieves.
Have tried for hundreds of times, but of no avail.
How would that help with anything? Anyways, if vim is problematic, try mcedit, it has an ESC b sequence for this (or Alt+b)
I wished if you could help in making a solution like the one suggested by @gstavi, in my post (#6).
That would have opened the path for future needs being satisfied myself.
Also, mcedit (if am not wrong) is an acronym for 'MidNight Commander', which am unsure of still. The site here hope is in correct direction, please vindicate.
-----
P.S. : Have installed mcedit, but seems that need to see the line numbers at the top (as the option for adding the line number, as stated here does make no difference; in terms of adding line numbers to the left end, as in vim), rather than at the left end of each line, as in vim. But, still don't know how to see the matching close brace line by using 'Alt+b'.
First move the cursor onto a { or } character, then press Alt+b
You can practice with another key combination: Alt+n (or Esc n) toggles line numbers on/off.
First move the cursor onto a { or } character, then press Alt+b
You can practice with another key combination: Alt+n (or Esc n) toggles line numbers on/off.
Thanks a lot, but the same feature should have been elsewhere (other editors) too. Regarding vim, it might be the case that it is not correctly working on the WSL ubuntu (over Windows).
Also, please help (if possible) in implementing the idea of @gstavi in (my) post #6.
First try another file or location, where you can see both the opening and closing bracket/paren and press %. You will see how the cursor is moving.
Your case is almost the same, just the cursor is moving out of the display (probably).
see https://www.youtube.com/watch?v=K05TpcntFXs&t=320s
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.