LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-16-2005, 07:05 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
PHP - getting a parse error after emacs indent-region


This is very strange... I've been pounding my head on this for a while.

I'm working on some php code that was written by someone else who likes to use a '#' to denote a comment. Emacs, for some reason, doesn't like the '#' and does not indent properly when it is used to denote comments. Because of that, I went through and replaced all the '#' with "//" and tested that the code still worked... it did. So then I selected the entire file (1600 lines or so) and used the indent-region function in emacs to make the code more easily readable... now I get a parse error, and a strange one at that:

Parse error: parse error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING

It's refering to the bold line:
Code:
    while ($line = mysql_fetch_array($result, MYSQL_NUM)) {
      $order_array[] = $line[0];
    }
Because I was getting frustrated, I just commented out that line to see if it would work, but I still get the same error on the same line - even if the line is a comment! If I change the code so that it does not have any square brackets, the same error comes up on the next square bracket in the file.

What gives?
 
Old 12-16-2005, 07:25 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Figures - as soon as I resort to asking, I figure it out.

The problem was upstream a bit further with this bit of code:
Code:
$query = <<< QUERY
SELECT foo
FROM bar
WHERE stuff;
QUERY;
Evidently, all lines must start at column 0 between QUERY and QUERY.

What the heck is the "<<<" operator anyway? Looks kinda like a struct of some sort... ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP parse error in config.inc.php.in Confusedious Linux - Software 2 11-03-2005 05:08 AM
indent cpp file with emacs~ black Linux - Software 10 09-10-2004 12:43 AM
failed on modifying indent on emacs~ black Linux - Software 0 07-22-2004 11:59 PM
emacs - convert auto indent tabs to spaces? BrianK Linux - General 1 04-15-2004 10:14 PM
php parse error wujimon Linux - Software 4 03-26-2003 02:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration