Questions tagged [line-continuation]

For questions and topics related to programming statements and programming syntax. This relates to any sequence of characters, used to indicate where the end of the statement appears in the context of parsing, or lexical analysis, of source code files.

Overview

In computer science, lexical analysis, lexing or tokenization is the process of converting a sequence of characters (such as in a computer program or web page) into a sequence of tokens (strings with an assigned and thus identified meaning).

Line continuation

Line continuation is an element of lexical analysis.

It is a feature of some languages where a newline is normally a statement terminator.

Most often, ending a line with a backslash (immediately followed by a newline) results in the line being continued – the following line is joined to the prior line. This is generally done in the lexer: the backslash and newline are discarded, rather than the newline being tokenized. Examples include bash,[8] other shell scripts and Python.[9]

23 questions
971
votes
7 answers

Split long commands in multiple lines through Windows batch file

How can I split long commands over multiple lines in a batch file?
Dan
24
votes
3 answers

Prevent Visual Studio 2015 from removing line continuation characters (_) in VB.NET files

I'm opening some old VB.NET projects in Visual Studio 2015 and when I edit the code, VS changes the syntax: It removes "_" in concatenations: 'Before myString = "ABC" & _ "DEF" 'After myString = "ABC" & "DEF" or add a space…
5
votes
2 answers

Line Continuation Mid String In Powershell

I'm trying to write an FFmpeg command on system that has two identical capture cards, so I have to use their "alternate names" or FFmpeg doesn't understand which one I'm calling. The only problem is the alternate names are extremely long,…
ninbura
  • 450
  • 6
  • 14
4
votes
1 answer

Python: Any work-arounds for commenting out a line in the middle of line concatenation

I have this kind of line concatenation: t = "first long line" +\ "second long line" +\ "third long line" Syntax error is raised if the second line is commented out in place with hash # The matter is I don't wish to remove the second line as…
Dee
  • 7,455
  • 6
  • 36
  • 70
3
votes
1 answer

Why no line break before `+` but before `.` in Kotlin?

I am trying to understand this answer: https://stackoverflow.com/a/44180583/481061 and particularly this part: if the first line of the statement is a valid statement, it won't work: val text = "This " + "is " + "a " + "long " + "long " +…
Felix Dombek
  • 13,664
  • 17
  • 79
  • 131
3
votes
1 answer

javascript: clean way to have a return statement span multiple lines

i'd like to have a javascript return keyword on one line, and the thing it actually returns on the next line. in python this would be something like return \ someValue however due to the optionality of statement-terminating semicolons and the…
orion elenzil
  • 4,484
  • 3
  • 37
  • 49
2
votes
1 answer

Powershell still prompting for credential even when using System.Management.Automation.PSCredential

I have created the following variable $cred: $User = "sa" $PWord = ConvertTo-SecureString -String "teste" -AsPlainText -Force $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord Then, I open a…
Potter
  • 434
  • 8
  • 21
2
votes
1 answer

Splitting long commands with caret (^) not working with Piping (|) in Batch file

The answers on this question state that long commands can be split into multiple lines via the use of the caret character (^). One answer provides a technical description: the caret and the newline that follows it are removed entirely from the…
Prid
  • 1,272
  • 16
  • 20
2
votes
1 answer

Line continuation not working in VBA for 2D Array construction

In the following Subroutine, defining a two dimensional array doesn't seem to work with line continuation. TestArray1 initializes as expected, but when I add line continuation I get the message, "Compile Error - Closing bracket…
Lyspon
  • 31
  • 3
1
vote
2 answers

What is the significance of backslashes, backticks, and carets in various shells

I am following https://docs.docker.com/get-started/06_bind_mounts/#start-a-dev-mode-container on a Windows PC and am stuck here: Run the following command. We’ll explain what’s going on afterwards: docker run -dp 3000:3000 \ -w /app -v…
user1032531
  • 24,767
  • 68
  • 217
  • 387
1
vote
1 answer

How to write comments in batch files for ffmpeg?

I'm quite new to ffmpeg and writing batches for command-line. I have a bunch of ffmpeg batch files, for various video processing tasks, that I'd like to add comments to so that other users can understand them and customize as required. Can anyone…
0
votes
2 answers

Python in VS Code Not Allowing Implicit Line Continuation?

I was reading that Python allows for implicit line continuation as long as you are in brackets or parentheses; however in VS Code it doesn't seem to allow this behavior for me, and I'm required to use the explicit forward slash line…
0
votes
0 answers

Syntax error at input 'end of line without line continuation'

The code is producing this error in line 5:13: Syntax error at input 'end of line without line continuation'; Below the piece of code: //@version=5 strategy("MF chat3 Supertrend Strategy", overlay=true) import talib // SuperTrend Function atrPeriod…
0
votes
1 answer

Remove or hinder "Line Continuation" in SQL

Currently we are using query aggregation for all of our SQL transaction. We are now looking to add BLOB support to the server, which would mean that we will have to convert the byte array to a string, so it can be sent with the query. We would like…
0
votes
1 answer

Syntax error on finding substring as whole word

I was doing pandas query on sub-string as a whole word `dfs = [] for row in mapping_excel.to_dict(orient='records'): query_filter = ' & '.join([f'{k}.str.contains("{v}",case= False, na=False)' for k,v in row.items() if v and k !=…
1
2