LinuxQuestions.org
Visit Jeremy's Blog.
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, 08: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, 08: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:08 AM
indent cpp file with emacs~ black Linux - Software 10 09-10-2004 01:43 AM
failed on modifying indent on emacs~ black Linux - Software 0 07-23-2004 12:59 AM
emacs - convert auto indent tabs to spaces? BrianK Linux - General 1 04-15-2004 11:14 PM
php parse error wujimon Linux - Software 4 03-26-2003 03:37 PM

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

All times are GMT -5. The time now is 07:27 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration